Commit 202be748 by Jason Merrill Committed by Jason Merrill

decl.c (grokdeclarator): Don't ICE on constexpr non-static data member.

	* decl.c (grokdeclarator): Don't ICE on constexpr non-static data
	member.

	* parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
	message about constexpr without -std=c++0x.

From-SVN: r166122
parent e2c50b7e
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.
......
......@@ -9652,8 +9652,11 @@ grokdeclarator (const cp_declarator *declarator,
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;
......
......@@ -2698,8 +2698,11 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
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;
......
// { dg-options "-std=c++98" }
constexpr int i = 42; // { dg-message "std=c\\+\\+0x" }
// { dg-error "constexpr" "" { target *-*-* } 3 }
// { dg-options -std=c++0x }
struct A
{
constexpr int i; // { dg-error "" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment