aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2009-07-13 16:15:55 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2009-07-13 09:15:55 -0700
commit84a900c9665efdb29d2a80275928fa40e2ab42a4 (patch)
tree16d05628c5042c8f85ea33665d228fbcde12321d /gcc/cp
parentacbdc378b68627af9126064e556981989cff13c3 (diff)
downloadgcc-84a900c9665efdb29d2a80275928fa40e2ab42a4.zip
gcc-84a900c9665efdb29d2a80275928fa40e2ab42a4.tar.gz
gcc-84a900c9665efdb29d2a80275928fa40e2ab42a4.tar.bz2
re PR c++/22154 ([DR 382] qualified names should allow typename keyword in front of it (even in non-templates))
2009-07-13 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C++/22154 * parser.c (cp_parser_elaborated_type_specifier): Accept typename in front of qualified names. 2009-07-13 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C++/22154 * g++.old-deja/g++.pt/typename10.C: Update for DR 382, typename in front of qualified names are allowed. * g++.dg/parse/crash10.C: Likewise. * g++.dg/parse/error15.C: Likewise. * g++.dg/parse/typename9.C: Likewise. * g++.dg/parse/error8.C: Likewise. From-SVN: r149590
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9c4cd01..97e5b3b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-13 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR C++/22154
+ * parser.c (cp_parser_elaborated_type_specifier): Accept typename in
+ front of qualified names.
+
2009-07-12 Jason Merrill <jason@redhat.com>
PR c++/36628
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d6d4d5b..94fba02 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11591,6 +11591,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
tree identifier;
tree type = NULL_TREE;
tree attributes = NULL_TREE;
+ tree globalscope;
cp_token *token = NULL;
/* See if we're looking at the `enum' keyword. */
@@ -11622,9 +11623,6 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
cp_lexer_consume_token (parser->lexer);
/* Remember that it's a `typename' type. */
tag_type = typename_type;
- /* The `typename' keyword is only allowed in templates. */
- if (!processing_template_decl)
- permerror (input_location, "using %<typename%> outside of template");
}
/* Otherwise it must be a class-key. */
else
@@ -11637,10 +11635,10 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
}
/* Look for the `::' operator. */
- cp_parser_global_scope_opt (parser,
- /*current_scope_valid_p=*/false);
+ globalscope = cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
/* Look for the nested-name-specifier. */
- if (tag_type == typename_type)
+ if (tag_type == typename_type && !globalscope)
{
if (!cp_parser_nested_name_specifier (parser,
/*typename_keyword_p=*/true,