member.
* parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
message about constexpr without -std=c++0x.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166122
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-10-31 Jason Merrill <jason@redhat.com>
+
+ * parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
+ message about constexpr without -std=c++0x.
+
+ * decl.c (grokdeclarator): Don't ICE on constexpr non-static data
+ member.
+
2010-10-30 Nathan Froyd <froydnj@codesourcery.com>
* class.c (layout_vtable_decl): Call build_array_of_n_type.
else
{
if (constexpr_p)
- error ("non-static data member %qE declared %<constexpr%>",
- unqualified_id);
+ {
+ error ("non-static data member %qE declared %<constexpr%>",
+ unqualified_id);
+ constexpr_p = false;
+ }
decl = build_decl (input_location,
FIELD_DECL, unqualified_id, type);
DECL_NONADDRESSABLE_P (decl) = bitfield;
template <typename T> struct B : public A<T> { X x; };
The user should have said "typename A<T>::X". */
- if (processing_template_decl && current_class_type
- && TYPE_BINFO (current_class_type))
+ if (cxx_dialect < cxx0x && id == ridpointers[(int)RID_CONSTEXPR])
+ inform (location, "C++0x %<constexpr%> only available with "
+ "-std=c++0x or -std=gnu++0x");
+ else if (processing_template_decl && current_class_type
+ && TYPE_BINFO (current_class_type))
{
tree b;
--- /dev/null
+// { dg-options "-std=c++98" }
+
+constexpr int i = 42; // { dg-message "std=c\\+\\+0x" }
+// { dg-error "constexpr" "" { target *-*-* } 3 }
--- /dev/null
+// { dg-options -std=c++0x }
+
+struct A
+{
+ constexpr int i; // { dg-error "" }
+};