Index: cp/decl.c =================================================================== --- cp/decl.c (revision 154234) +++ cp/decl.c (working copy) @@ -4926,7 +4926,8 @@ reshape_init_r (tree type, reshape_iter init = error_mark_node; } else - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); } d->cur++; @@ -5170,7 +5171,8 @@ check_initializer (tree decl, tree init, { if (init_len == 0) { - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists only " + "available with -std=c++0x or -std=gnu++0x"); init = build_zero_init (type, NULL_TREE, false); } else if (init_len != 1) @@ -8523,7 +8525,9 @@ grokdeclarator (const cp_declarator *dec { if (explicitp == 1) { - maybe_warn_cpp0x ("explicit conversion operators"); + maybe_warn_cpp0x ("explicit conversion operators only " + "available with -std=c++0x or " + "-std=gnu++0x"); explicitp = 2; } } Index: cp/error.c =================================================================== --- cp/error.c (revision 154234) +++ cp/error.c (working copy) @@ -2885,20 +2885,21 @@ cp_printer (pretty_printer *pp, text_inf /* Warn about the use of C++0x features when appropriate. */ void -maybe_warn_cpp0x (const char* str) +maybe_warn_cpp0x (const char* gmsgid) { if ((cxx_dialect == cxx98) && !in_system_header) /* We really want to suppress this warning in system headers, because libstdc++ uses variadic templates even when we aren't in C++0x mode. */ - pedwarn (input_location, 0, "%s only available with -std=c++0x or -std=gnu++0x", str); + pedwarn (input_location, 0, gmsgid); } /* Warn about the use of variadic templates when appropriate. */ void maybe_warn_variadic_templates (void) { - maybe_warn_cpp0x ("variadic templates"); + maybe_warn_cpp0x ("variadic templates " + "only available with -std=c++0x or -std=gnu++0x"); } Index: cp/parser.c =================================================================== --- cp/parser.c (revision 154234) +++ cp/parser.c (working copy) @@ -3329,7 +3329,8 @@ cp_parser_primary_expression (cp_parser if (c_dialect_objc ()) /* We have an Objective-C++ message. */ return cp_parser_objc_expression (parser); - maybe_warn_cpp0x ("lambda expressions"); + maybe_warn_cpp0x ("lambda expressions " + "only available with -std=c++0x or -std=gnu++0x"); return cp_parser_lambda_expression (parser); case CPP_OBJC_STRING: @@ -5275,7 +5276,8 @@ cp_parser_parenthesized_expression_list if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { /* A braced-init-list. */ - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists only " + "available with -std=c++0x or -std=gnu++0x"); expr = cp_parser_braced_list (parser, &expr_non_constant_p); if (non_constant_p && expr_non_constant_p) *non_constant_p = true; @@ -5992,7 +5994,8 @@ cp_parser_new_initializer (cp_parser* pa { tree t; bool expr_non_constant_p; - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); t = cp_parser_braced_list (parser, &expr_non_constant_p); CONSTRUCTOR_IS_DIRECT_INIT (t) = 1; expression_list = make_tree_vector_single (t); @@ -6553,7 +6556,8 @@ cp_parser_assignment_expression (cp_pars tree rhs = cp_parser_initializer_clause (parser, &non_constant_p); if (BRACE_ENCLOSED_INITIALIZER_P (rhs)) - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists only " + "available with -std=c++0x or -std=gnu++0x"); /* An assignment may not appear in a constant-expression. */ @@ -8143,7 +8147,8 @@ cp_parser_condition (cp_parser* parser) initializer = cp_parser_initializer_clause (parser, &non_constant_p); } if (BRACE_ENCLOSED_INITIALIZER_P (initializer)) - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); if (!non_constant_p) initializer = fold_non_dependent_expr (initializer); @@ -8407,7 +8412,8 @@ cp_parser_jump_statement (cp_parser* par if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); expr = cp_parser_braced_list (parser, &expr_non_constant_p); } else if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) @@ -9922,7 +9928,8 @@ cp_parser_mem_initializer (cp_parser* pa if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { bool expr_non_constant_p; - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); expression_list = cp_parser_braced_list (parser, &expr_non_constant_p); CONSTRUCTOR_IS_DIRECT_INIT (expression_list) = 1; expression_list = build_tree_list (NULL_TREE, expression_list); @@ -11933,7 +11940,8 @@ cp_parser_simple_type_specifier (cp_pars break; case RID_AUTO: - maybe_warn_cpp0x ("C++0x auto"); + maybe_warn_cpp0x ("C++0x auto " + "only available with -std=c++0x or -std=gnu++0x"); type = make_auto (); break; @@ -12240,7 +12248,8 @@ cp_parser_elaborated_type_specifier (cp_ || cp_lexer_next_token_is_keyword (parser->lexer, RID_STRUCT)) { if (cxx_dialect == cxx98) - maybe_warn_cpp0x ("scoped enums"); + maybe_warn_cpp0x ("scoped enums only " + "available with -std=c++0x or -std=gnu++0x"); /* Consume the `struct' or `class'. */ cp_lexer_consume_token (parser->lexer); @@ -12577,7 +12586,8 @@ cp_parser_enum_specifier (cp_parser* par || cp_lexer_next_token_is_keyword (parser->lexer, RID_STRUCT)) { if (cxx_dialect == cxx98) - maybe_warn_cpp0x ("scoped enums"); + maybe_warn_cpp0x ("scoped enums " + "only available with -std=c++0x or -std=gnu++0x"); /* Consume the `struct' or `class' token. */ cp_lexer_consume_token (parser->lexer); @@ -12611,7 +12621,8 @@ cp_parser_enum_specifier (cp_parser* par return NULL_TREE; if (cxx_dialect == cxx98) - maybe_warn_cpp0x ("scoped enums"); + maybe_warn_cpp0x ("scoped enums " + "only available with -std=c++0x or -std=gnu++0x"); has_underlying_type = true; @@ -15425,7 +15436,8 @@ cp_parser_initializer (cp_parser* parser } else if (token->type == CPP_OPEN_BRACE) { - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); init = cp_parser_braced_list (parser, non_constant_p); CONSTRUCTOR_IS_DIRECT_INIT (init) = 1; } @@ -16895,7 +16907,8 @@ cp_parser_pure_specifier (cp_parser* par if (token->keyword == RID_DEFAULT || token->keyword == RID_DELETE) { - maybe_warn_cpp0x ("defaulted and deleted functions"); + maybe_warn_cpp0x ("defaulted and deleted functions " + "only available with -std=c++0x or -std=gnu++0x"); return token->u.value; } @@ -18895,7 +18908,8 @@ cp_parser_functional_cast (cp_parser* pa if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); expression_list = cp_parser_braced_list (parser, &nonconst_p); CONSTRUCTOR_IS_DIRECT_INIT (expression_list) = 1; if (TREE_CODE (type) == TYPE_DECL) Index: cp/call.c =================================================================== --- cp/call.c (revision 154234) +++ cp/call.c (working copy) @@ -1228,7 +1228,8 @@ reference_binding (tree rto, tree rfrom, if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)) { - maybe_warn_cpp0x ("extended initializer lists"); + maybe_warn_cpp0x ("extended initializer lists " + "only available with -std=c++0x or -std=gnu++0x"); conv = implicit_conversion (to, from, expr, c_cast_p, flags); if (!CLASS_TYPE_P (to) Index: testsuite/g++.old-deja/g++.other/crash28.C =================================================================== --- testsuite/g++.old-deja/g++.other/crash28.C (revision 154234) +++ testsuite/g++.old-deja/g++.other/crash28.C (working copy) @@ -31,5 +31,5 @@ public: }; void foo::x() throw(bar) { - if (!b) throw bar (static_cast<::N::X*>(this)); // { dg-error "" } parse error + if (!b) throw bar (static_cast<::N::X*>(this)); // { dg-error "lambda expressions|expected" } parse error } Index: testsuite/g++.dg/inherit/error4.C =================================================================== --- testsuite/g++.dg/inherit/error4.C (revision 154234) +++ testsuite/g++.dg/inherit/error4.C (working copy) @@ -2,7 +2,7 @@ struct A { virtual ~A(); }; -struct B : A A {}; // { dg-error "" } +struct B : A A {}; // { dg-error "expected|initializer|invalid" } A foo(const B &b) // { dg-error "" } { Index: testsuite/g++.dg/template/crash90.C =================================================================== --- testsuite/g++.dg/template/crash90.C (revision 154234) +++ testsuite/g++.dg/template/crash90.C (working copy) @@ -4,5 +4,5 @@ template < unsigned > struct A ; template < typename > struct B ; -template < typename T , A < B < T > // { dg-error "" } +template < typename T , A < B < T > // { dg-error "initializer|parse error|valid type|expected" } { }