* semantics.c (finish_decltype_type): For SCOPE_REF issue an
error instead of assertion failure.
* parser.c (cp_parser_decltype): If closing paren is not found,
return error_mark_node.
* g++.dg/cpp0x/decltype9.C: New test.
* g++.dg/cpp0x/decltype10.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130619
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-12-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/34271
+ * semantics.c (finish_decltype_type): For SCOPE_REF issue an
+ error instead of assertion failure.
+ * parser.c (cp_parser_decltype): If closing paren is not found,
+ return error_mark_node.
+
2007-12-04 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34101
/* Parse to the closing `)'. */
if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
- cp_parser_skip_to_closing_parenthesis (parser, true, false,
- /*consume_paren=*/true);
+ {
+ cp_parser_skip_to_closing_parenthesis (parser, true, false,
+ /*consume_paren=*/true);
+ return error_mark_node;
+ }
return finish_decltype_type (expr, id_expression_or_member_access_p);
}
break;
default:
- gcc_assert (TYPE_P (expr) || DECL_P (expr));
+ gcc_assert (TYPE_P (expr) || DECL_P (expr)
+ || TREE_CODE (expr) == SCOPE_REF);
error ("argument to decltype must be an expression");
return error_mark_node;
}
+2007-12-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/34271
+ * g++.dg/cpp0x/decltype9.C: New test.
+ * g++.dg/cpp0x/decltype10.C: New test.
+
2007-12-05 Samuel Tardieu <sam@rfc1149.net>
PR ada/21489
--- /dev/null
+// PR c++/34271
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template<int> struct A
+{
+ static int i;
+};
+
+template<int N> int A<N>::i(decltype (A::i; // { dg-error "expected primary-expression before" }
--- /dev/null
+// PR c++/34271
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template<int> struct A
+{
+ static int i;
+};
+
+template<int N> int A<N>::i(decltype (A::i)); // { dg-error "member function|must be an expression" }