diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0339-PR-c-46245.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0339-PR-c-46245.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0339-PR-c-46245.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0339-PR-c-46245.patch new file mode 100644 index 0000000000..67295c5f75 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0339-PR-c-46245.patch | |||
@@ -0,0 +1,88 @@ | |||
1 | From 5c27b6339932010631806a4c36f57ad909d3ce35 Mon Sep 17 00:00:00 2001 | ||
2 | From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Wed, 25 May 2011 20:29:54 +0000 | ||
4 | Subject: [PATCH] PR c++/46245 | ||
5 | * decl.c (grokdeclarator): Complain later for auto parameter. | ||
6 | * pt.c (splice_late_return_type): Handle use in a template | ||
7 | type-parameter. | ||
8 | |||
9 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174234 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
10 | |||
11 | index 9e029d2..dbf03f9 100644 | ||
12 | --- a/gcc/cp/decl.c | ||
13 | +++ b/gcc/cp/decl.c | ||
14 | @@ -8559,12 +8559,6 @@ grokdeclarator (const cp_declarator *declarator, | ||
15 | || thread_p) | ||
16 | error ("storage class specifiers invalid in parameter declarations"); | ||
17 | |||
18 | - if (type_uses_auto (type)) | ||
19 | - { | ||
20 | - error ("parameter declared %<auto%>"); | ||
21 | - type = error_mark_node; | ||
22 | - } | ||
23 | - | ||
24 | /* Function parameters cannot be constexpr. If we saw one, moan | ||
25 | and pretend it wasn't there. */ | ||
26 | if (constexpr_p) | ||
27 | @@ -9550,6 +9544,12 @@ grokdeclarator (const cp_declarator *declarator, | ||
28 | if (ctype || in_namespace) | ||
29 | error ("cannot use %<::%> in parameter declaration"); | ||
30 | |||
31 | + if (type_uses_auto (type)) | ||
32 | + { | ||
33 | + error ("parameter declared %<auto%>"); | ||
34 | + type = error_mark_node; | ||
35 | + } | ||
36 | + | ||
37 | /* A parameter declared as an array of T is really a pointer to T. | ||
38 | One declared as a function is really a pointer to a function. | ||
39 | One declared as a member is really a pointer to member. */ | ||
40 | diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c | ||
41 | index c5f2422..3afeb9b 100644 | ||
42 | --- a/gcc/cp/pt.c | ||
43 | +++ b/gcc/cp/pt.c | ||
44 | @@ -19061,7 +19061,12 @@ splice_late_return_type (tree type, tree late_return_type) | ||
45 | return type; | ||
46 | argvec = make_tree_vec (1); | ||
47 | TREE_VEC_ELT (argvec, 0) = late_return_type; | ||
48 | - if (processing_template_decl) | ||
49 | + if (processing_template_parmlist) | ||
50 | + /* For a late-specified return type in a template type-parameter, we | ||
51 | + need to add a dummy argument level for its parmlist. */ | ||
52 | + argvec = add_to_template_args | ||
53 | + (make_tree_vec (processing_template_parmlist), argvec); | ||
54 | + if (current_template_parms) | ||
55 | argvec = add_to_template_args (current_template_args (), argvec); | ||
56 | return tsubst (type, argvec, tf_warning_or_error, NULL_TREE); | ||
57 | } | ||
58 | new file mode 100644 | ||
59 | index 0000000..49b5a0e | ||
60 | --- /dev/null | ||
61 | +++ b/gcc/testsuite/g++.dg/cpp0x/auto23.C | ||
62 | @@ -0,0 +1,4 @@ | ||
63 | +// PR c++/46245 | ||
64 | +// { dg-options -std=c++0x } | ||
65 | + | ||
66 | +template<auto f()->int> struct A { }; | ||
67 | diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C | ||
68 | index ab90be5..142ef90 100644 | ||
69 | --- a/gcc/testsuite/g++.dg/cpp0x/auto9.C | ||
70 | +++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C | ||
71 | @@ -79,10 +79,10 @@ enum struct D : auto * { FF = 0 }; // { dg-error "must be an integral type|decl | ||
72 | void | ||
73 | bar () | ||
74 | { | ||
75 | - try { } catch (auto i) { } // { dg-error "invalid use of" } | ||
76 | - try { } catch (auto) { } // { dg-error "invalid use of" } | ||
77 | - try { } catch (auto *i) { } // { dg-error "invalid use of" } | ||
78 | - try { } catch (auto *) { } // { dg-error "invalid use of" } | ||
79 | + try { } catch (auto i) { } // { dg-error "parameter declared" } | ||
80 | + try { } catch (auto) { } // { dg-error "parameter declared" } | ||
81 | + try { } catch (auto *i) { } // { dg-error "parameter declared" } | ||
82 | + try { } catch (auto *) { } // { dg-error "parameter declared" } | ||
83 | } | ||
84 | |||
85 | void | ||
86 | -- | ||
87 | 1.7.0.4 | ||
88 | |||