PR c++/57471
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Jul 2013 21:52:40 +0000 (21:52 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Jul 2013 21:52:40 +0000 (21:52 +0000)
* parser.c (cp_parser_sizeof_pack): Clear parser scopes.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200852 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/variadic-sizeof2.C [new file with mode: 0644]

index 88ba769..1bc0b6f 100644 (file)
@@ -1,5 +1,8 @@
 2013-07-09  Jason Merrill  <jason@redhat.com>
 
+       PR c++/57471
+       * parser.c (cp_parser_sizeof_pack): Clear parser scopes.
+
        PR c++/57658
        * semantics.c (finish_id_expression): Return the id for an
        unevaluated outer variable.
index 614cf43..4b683bf 100644 (file)
@@ -23136,6 +23136,10 @@ cp_parser_sizeof_pack (cp_parser *parser)
 
   cp_token *token = cp_lexer_peek_token (parser->lexer);
   tree name = cp_parser_identifier (parser);
+  /* The name is not qualified.  */
+  parser->scope = NULL_TREE;
+  parser->qualifying_scope = NULL_TREE;
+  parser->object_scope = NULL_TREE;
   tree expr = cp_parser_lookup_name_simple (parser, name, token->location);
   if (expr == error_mark_node)
     cp_parser_name_lookup_error (parser, name, expr, NLE_NULL,
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof2.C
new file mode 100644 (file)
index 0000000..dfc245d
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/57471
+// { dg-require-effective-target c++11 }
+
+struct A
+{
+  static constexpr bool value = true;
+};
+
+template<typename... Types>
+struct B
+{
+  static_assert(A::value, "");
+  static_assert(sizeof...(Types) == 0, "");
+};