Index: gcc/cp/typeck.c =================================================================== --- gcc/cp/typeck.c (revision 136847) +++ gcc/cp/typeck.c (working copy) @@ -435,9 +435,9 @@ else { if (complain & tf_error) - pedwarn ("%s between distinct pointer types %qT and %qT " - "lacks a cast", - location, t1, t2); + permerror ("%s between distinct pointer types %qT and %qT " + "lacks a cast", + location, t1, t2); result_type = void_type_node; } result_type = cp_build_qualified_type (result_type, @@ -450,9 +450,9 @@ if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1), TYPE_PTRMEM_CLASS_TYPE (t2)) && (complain & tf_error)) - pedwarn ("%s between distinct pointer types %qT and %qT " - "lacks a cast", - location, t1, t2); + permerror ("%s between distinct pointer types %qT and %qT " + "lacks a cast", + location, t1, t2); result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1), result_type); } @@ -1355,8 +1355,8 @@ else if (is_overloaded_fn (e)) { if (complain & tf_error) - pedwarn ("ISO C++ forbids applying % to an expression of " - "function type"); + permerror ("ISO C++ forbids applying % to an expression of " + "function type"); else return error_mark_node; e = char_type_node; @@ -1415,8 +1415,8 @@ else if (is_overloaded_fn (e)) { if (complain & tf_error) - pedwarn ("ISO C++ forbids applying %<__alignof%> to an expression of " - "function type"); + permerror ("ISO C++ forbids applying %<__alignof%> to an expression of " + "function type"); else return error_mark_node; if (TREE_CODE (e) == FUNCTION_DECL) @@ -2146,7 +2146,7 @@ && TREE_CODE (decl) != TEMPLATE_ID_EXPR) { if (!is_overloaded_fn (decl)) - pedwarn ("%qD is not a template", decl); + permerror ("%qD is not a template", decl); else { tree fns; @@ -2166,7 +2166,7 @@ fns = OVL_NEXT (fns); } if (!fns) - pedwarn ("%qD is not a template", decl); + permerror ("%qD is not a template", decl); } } } @@ -3544,7 +3544,7 @@ { result_type = type0; if (complain & tf_error) - pedwarn ("ISO C++ forbids comparison between pointer and integer"); + permerror ("ISO C++ forbids comparison between pointer and integer"); else return error_mark_node; } @@ -3552,7 +3552,7 @@ { result_type = type1; if (complain & tf_error) - pedwarn ("ISO C++ forbids comparison between pointer and integer"); + permerror ("ISO C++ forbids comparison between pointer and integer"); else return error_mark_node; } @@ -3732,7 +3732,7 @@ { result_type = type0; if (complain & tf_error) - pedwarn ("ISO C++ forbids comparison between pointer and integer"); + permerror ("ISO C++ forbids comparison between pointer and integer"); else return error_mark_node; } @@ -3740,7 +3740,7 @@ { result_type = type1; if (complain & tf_error) - pedwarn ("ISO C++ forbids comparison between pointer and integer"); + permerror ("ISO C++ forbids comparison between pointer and integer"); else return error_mark_node; } @@ -4111,11 +4111,11 @@ if (pedantic || warn_pointer_arith) { if (TREE_CODE (target_type) == VOID_TYPE) - pedwarn ("ISO C++ forbids using pointer of type % in subtraction"); + permerror ("ISO C++ forbids using pointer of type % in subtraction"); if (TREE_CODE (target_type) == FUNCTION_TYPE) - pedwarn ("ISO C++ forbids using pointer to a function in subtraction"); + permerror ("ISO C++ forbids using pointer to a function in subtraction"); if (TREE_CODE (target_type) == METHOD_TYPE) - pedwarn ("ISO C++ forbids using pointer to a method in subtraction"); + permerror ("ISO C++ forbids using pointer to a method in subtraction"); } /* First do the subtraction as integers; @@ -4481,9 +4481,9 @@ if (TREE_CODE (argtype) == ENUMERAL_TYPE) { if (complain & tf_error) - pedwarn ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) - ? G_("ISO C++ forbids incrementing an enum") - : G_("ISO C++ forbids decrementing an enum")); + permerror ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) + ? G_("ISO C++ forbids incrementing an enum") + : G_("ISO C++ forbids decrementing an enum")); else return error_mark_node; } @@ -4509,11 +4509,11 @@ && !TYPE_PTROB_P (argtype)) { if (complain & tf_error) - pedwarn ((code == PREINCREMENT_EXPR - || code == POSTINCREMENT_EXPR) - ? G_("ISO C++ forbids incrementing a pointer of type %qT") - : G_("ISO C++ forbids decrementing a pointer of type %qT"), - argtype); + permerror ((code == PREINCREMENT_EXPR + || code == POSTINCREMENT_EXPR) + ? G_("ISO C++ forbids incrementing a pointer of type %qT") + : G_("ISO C++ forbids decrementing a pointer of type %qT"), + argtype); else return error_mark_node; } @@ -4570,7 +4570,7 @@ { /* ARM $3.4 */ if (complain & tf_error) - pedwarn ("ISO C++ forbids taking address of function %<::main%>"); + permerror ("ISO C++ forbids taking address of function %<::main%>"); else return error_mark_node; } @@ -4631,15 +4631,15 @@ else if (current_class_type && TREE_OPERAND (arg, 0) == current_class_ref) /* An expression like &memfn. */ - pedwarn ("ISO C++ forbids taking the address of an unqualified" - " or parenthesized non-static member function to form" - " a pointer to member function. Say %<&%T::%D%>", - base, name); + permerror ("ISO C++ forbids taking the address of an unqualified" + " or parenthesized non-static member function to form" + " a pointer to member function. Say %<&%T::%D%>", + base, name); else - pedwarn ("ISO C++ forbids taking the address of a bound member" - " function to form a pointer to member function." - " Say %<&%T::%D%>", - base, name); + permerror ("ISO C++ forbids taking the address of a bound member" + " function to form a pointer to member function." + " Say %<&%T::%D%>", + base, name); } arg = build_offset_ref (base, fn, /*address_p=*/true); } @@ -4665,7 +4665,7 @@ if (! lvalue_p (arg) && (pedantic || complain == tf_none)) { if (complain & tf_error) - pedwarn ("ISO C++ forbids taking the address of a cast to a non-lvalue expression"); + permerror ("ISO C++ forbids taking the address of a cast to a non-lvalue expression"); else return error_mark_node; } @@ -5010,7 +5010,7 @@ if (TREE_CHAIN (list)) { if (msg) - pedwarn ("%s expression list treated as compound expression", msg); + permerror ("%s expression list treated as compound expression", msg); for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list)) expr = build_x_compound_expr (expr, TREE_VALUE (list), @@ -5561,8 +5561,8 @@ if (TYPE_PRECISION (type) < TYPE_PRECISION (intype)) { if (complain & tf_error) - pedwarn ("cast from %qT to %qT loses precision", - intype, type); + permerror ("cast from %qT to %qT loses precision", + intype, type); else return error_mark_node; } @@ -5838,7 +5838,7 @@ if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE) { if (complain & tf_error) - pedwarn ("ISO C++ forbids casting to an array type %qT", type); + permerror ("ISO C++ forbids casting to an array type %qT", type); else return error_mark_node; type = build_pointer_type (TREE_TYPE (type)); @@ -6964,8 +6964,8 @@ that's supposed to return a value. */ if (!retval && fn_returns_value_p) { - pedwarn ("return-statement with no value, in function returning %qT", - valtype); + permerror ("return-statement with no value, in function returning %qT", + valtype); /* Clear this, so finish_function won't say that we reach the end of a non-void function (which we don't, we gave a return!). */ @@ -6985,8 +6985,8 @@ its side-effects. */ finish_expr_stmt (retval); else - pedwarn ("return-statement with a value, in function " - "returning 'void'"); + permerror ("return-statement with a value, in function " + "returning 'void'"); current_function_returns_null = 1; Index: gcc/cp/init.c =================================================================== --- gcc/cp/init.c (revision 136847) +++ gcc/cp/init.c (working copy) @@ -533,11 +533,11 @@ } /* member traversal: note it leaves init NULL */ else if (TREE_CODE (type) == REFERENCE_TYPE) - pedwarn ("%Juninitialized reference member %qD", - current_function_decl, member); + permerror ("%Juninitialized reference member %qD", + current_function_decl, member); else if (CP_TYPE_CONST_P (type)) - pedwarn ("%Juninitialized member %qD with % type %qT", - current_function_decl, member, type); + permerror ("%Juninitialized member %qD with % type %qT", + current_function_decl, member, type); } else if (TREE_CODE (init) == TREE_LIST) /* There was an explicit member initialization. Do some work @@ -2158,7 +2158,7 @@ else if (init) { if (complain & tf_error) - pedwarn ("ISO C++ forbids initialization in array new"); + permerror ("ISO C++ forbids initialization in array new"); else return error_mark_node; } @@ -2370,7 +2370,7 @@ if (!build_expr_type_conversion (WANT_INT | WANT_ENUM, nelts, false)) { if (complain & tf_error) - pedwarn ("size in array new must have integral type"); + permerror ("size in array new must have integral type"); else return error_mark_node; } Index: gcc/cp/decl.c =================================================================== --- gcc/cp/decl.c (revision 136847) +++ gcc/cp/decl.c (working copy) @@ -1055,8 +1055,8 @@ return; name = DECL_ASSEMBLER_NAME (newdecl); - pedwarn ("%qD was declared % and later %", newdecl); - pedwarn ("previous declaration of %q+D", olddecl); + permerror ("%qD was declared % and later %", newdecl); + permerror ("previous declaration of %q+D", olddecl); } /* NEW_DECL is a redeclaration of OLD_DECL; both are functions or @@ -1539,9 +1539,9 @@ if (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))) { - pedwarn ("default argument given for parameter %d of %q#D", - i, newdecl); - pedwarn ("after previous specification in %q+#D", olddecl); + permerror ("default argument given for parameter %d of %q#D", + i, newdecl); + permerror ("after previous specification in %q+#D", olddecl); } else { @@ -2458,11 +2458,11 @@ identify_goto (tree decl, const location_t *locus) { if (decl) - pedwarn ("jump to label %qD", decl); + permerror ("jump to label %qD", decl); else - pedwarn ("jump to case label"); + permerror ("jump to case label"); if (locus) - pedwarn ("%H from here", locus); + permerror ("%H from here", locus); } /* Check that a single previously seen jump to a newly defined label @@ -2504,7 +2504,7 @@ if (problem > 1) error (" crosses initialization of %q+#D", new_decls); else - pedwarn (" enters scope of non-POD %q+#D", new_decls); + permerror (" enters scope of non-POD %q+#D", new_decls); } if (b == level) @@ -2600,8 +2600,8 @@ if (ent->in_try_scope || ent->in_catch_scope || ent->in_omp_scope || ent->bad_decls) { - pedwarn ("jump to label %q+D", decl); - pedwarn (" from here"); + permerror ("jump to label %q+D", decl); + permerror (" from here"); identified = true; } @@ -2619,7 +2619,7 @@ else if (u > 1) error (" skips initialization of %q+#D", b); else - pedwarn (" enters scope of non-POD %q+#D", b); + permerror (" enters scope of non-POD %q+#D", b); } if (ent->in_try_scope) @@ -2640,8 +2640,8 @@ { if (!identified) { - pedwarn ("jump to label %q+D", decl); - pedwarn (" from here"); + permerror ("jump to label %q+D", decl); + permerror (" from here"); identified = true; } error (" exits OpenMP structured block"); @@ -2693,7 +2693,7 @@ p->more_cleanups_ok = 0; if (name == get_identifier ("wchar_t")) - pedwarn ("label named wchar_t"); + permerror ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) { @@ -3767,8 +3767,8 @@ else if (declspecs->redefined_builtin_type) { if (!in_system_header) - pedwarn ("redeclaration of C++ built-in type %qT", - declspecs->redefined_builtin_type); + permerror ("redeclaration of C++ built-in type %qT", + declspecs->redefined_builtin_type); return NULL_TREE; } @@ -3781,7 +3781,7 @@ else if (declspecs->type == error_mark_node) error_p = true; if (declared_type == NULL_TREE && ! saw_friend && !error_p) - pedwarn ("declaration does not declare anything"); + permerror ("declaration does not declare anything"); /* Check for an anonymous union. */ else if (declared_type && RECORD_OR_UNION_CODE_P (TREE_CODE (declared_type)) && TYPE_ANONYMOUS_P (declared_type)) @@ -4054,10 +4054,10 @@ if (DECL_CONTEXT (field) != context) { if (!same_type_p (DECL_CONTEXT (field), context)) - pedwarn ("ISO C++ does not permit %<%T::%D%> " - "to be defined as %<%T::%D%>", - DECL_CONTEXT (field), DECL_NAME (decl), - context, DECL_NAME (decl)); + permerror ("ISO C++ does not permit %<%T::%D%> " + "to be defined as %<%T::%D%>", + DECL_CONTEXT (field), DECL_NAME (decl), + context, DECL_NAME (decl)); DECL_CONTEXT (decl) = DECL_CONTEXT (field); } if (processing_specialization @@ -4110,8 +4110,8 @@ } if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)) - pedwarn ("declaration of %q#D outside of class is not definition", - decl); + permerror ("declaration of %q#D outside of class is not definition", + decl); } was_public = TREE_PUBLIC (decl); @@ -6319,8 +6319,8 @@ The definition for a static data member shall appear in a namespace scope enclosing the member's class definition. */ if (!is_ancestor (current_namespace, DECL_CONTEXT (decl))) - pedwarn ("definition of %qD is not in namespace enclosing %qT", - decl, DECL_CONTEXT (decl)); + permerror ("definition of %qD is not in namespace enclosing %qT", + decl, DECL_CONTEXT (decl)); } /* Build a PARM_DECL for the "this" parameter. TYPE is the @@ -6553,16 +6553,16 @@ /* Allow this; it's pretty common in C. */; else { - pedwarn ("non-local function %q#D uses anonymous type", + permerror ("non-local function %q#D uses anonymous type", decl); if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) - pedwarn ("%q+#D does not refer to the unqualified " - "type, so it is not used for linkage", - TYPE_NAME (t)); + permerror ("%q+#D does not refer to the unqualified " + "type, so it is not used for linkage", + TYPE_NAME (t)); } } else - pedwarn ("non-local function %q#D uses local type %qT", decl, t); + permerror ("non-local function %q#D uses local type %qT", decl, t); } } @@ -7706,7 +7706,9 @@ /* We've already issued an error, don't complain more. */; else if (in_system_header || flag_ms_extensions) /* Allow it, sigh. */; - else if (pedantic || ! is_main) + else if (! is_main) + permerror ("ISO C++ forbids declaration of %qs with no type", name); + else if (pedantic) pedwarn ("ISO C++ forbids declaration of %qs with no type", name); else warning (OPT_Wreturn_type, @@ -8157,7 +8159,7 @@ explicitp = 2; if (virtualp) { - pedwarn ("constructors cannot be declared virtual"); + permerror ("constructors cannot be declared virtual"); virtualp = 0; } if (decl_context == FIELD @@ -8380,12 +8382,12 @@ { if (friendp) { - pedwarn ("member functions are implicitly friends of their class"); + permerror ("member functions are implicitly friends of their class"); friendp = 0; } else - pedwarn ("extra qualification %<%T::%> on member %qs", - ctype, name); + permerror ("extra qualification %<%T::%> on member %qs", + ctype, name); } else if (/* If the qualifying type is already complete, then we can skip the following checks. */ @@ -8569,9 +8571,9 @@ DECL_ABSTRACT (decl) = 1; } else if (constructor_name_p (unqualified_id, current_class_type)) - pedwarn ("ISO C++ forbids nested type %qD with same name " - "as enclosing class", - unqualified_id); + permerror ("ISO C++ forbids nested type %qD with same name " + "as enclosing class", + unqualified_id); /* If the user declares "typedef struct {...} foo" then the struct will have an anonymous name. Fill that name in now. @@ -8694,15 +8696,15 @@ { /* Don't allow friend declaration without a class-key. */ if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) - pedwarn ("template parameters cannot be friends"); + permerror ("template parameters cannot be friends"); else if (TREE_CODE (type) == TYPENAME_TYPE) - pedwarn ("friend declaration requires class-key, " - "i.e. %", - TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type)); + permerror ("friend declaration requires class-key, " + "i.e. %", + TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type)); else - pedwarn ("friend declaration requires class-key, " - "i.e. %", - type); + permerror ("friend declaration requires class-key, " + "i.e. %", + type); } /* Only try to do this stuff if we didn't already give up. */ @@ -8987,7 +8989,7 @@ { /* Friends are treated specially. */ if (ctype == current_class_type) - ; /* We already issued a pedwarn. */ + ; /* We already issued a permerror. */ else if (decl && DECL_NAME (decl)) { if (template_class_depth (current_class_type) == 0) @@ -9028,9 +9030,9 @@ the rest of the compiler does not correctly handle the initialization unless the member is static so we make it static below. */ - pedwarn ("ISO C++ forbids initialization of member %qD", - unqualified_id); - pedwarn ("making %qD static", unqualified_id); + permerror ("ISO C++ forbids initialization of member %qD", + unqualified_id); + permerror ("making %qD static", unqualified_id); staticp = 1; } @@ -9152,8 +9154,8 @@ declaring main to be static. */ if (TREE_CODE (type) == METHOD_TYPE) { - pedwarn ("cannot declare member function %qD to have " - "static linkage", decl); + permerror ("cannot declare member function %qD to have " + "static linkage", decl); invalid_static = 1; } else if (current_function_decl) @@ -9189,8 +9191,8 @@ DECL_CONTEXT (decl) = ctype; if (staticp == 1) { - pedwarn ("% may not be used when defining " - "(as opposed to declaring) a static data member"); + permerror ("% may not be used when defining " + "(as opposed to declaring) a static data member"); staticp = 0; storage_class = sc_none; } Index: gcc/cp/except.c =================================================================== --- gcc/cp/except.c (revision 136847) +++ gcc/cp/except.c (working copy) @@ -1015,8 +1015,8 @@ if (tsi_end_p (i)) break; if (TREE_TYPE (handler) == NULL_TREE) - pedwarn ("%H%<...%> handler must be the last handler for" - " its try block", EXPR_LOCUS (handler)); + permerror ("%H%<...%> handler must be the last handler for" + " its try block", EXPR_LOCUS (handler)); else check_handlers_1 (handler, i); } Index: gcc/cp/friend.c =================================================================== --- gcc/cp/friend.c (revision 136847) +++ gcc/cp/friend.c (working copy) @@ -253,8 +253,8 @@ else if (same_type_p (type, friend_type)) { if (complain) - pedwarn ("class %qT is implicitly friends with itself", - type); + permerror ("class %qT is implicitly friends with itself", + type); return; } Index: gcc/cp/typeck2.c =================================================================== --- gcc/cp/typeck2.c (revision 136847) +++ gcc/cp/typeck2.c (working copy) @@ -694,7 +694,7 @@ counted in the length of the constant, but in C++ this would be invalid. */ if (size < TREE_STRING_LENGTH (init)) - pedwarn ("initializer-string for array of chars is too long"); + permerror ("initializer-string for array of chars is too long"); } return init; } Index: gcc/cp/pt.c =================================================================== --- gcc/cp/pt.c (revision 136847) +++ gcc/cp/pt.c (working copy) @@ -710,8 +710,8 @@ return true; else { - pedwarn ("specialization of %qD in different namespace", tmpl); - pedwarn (" from definition of %q+#D", tmpl); + permerror ("specialization of %qD in different namespace", tmpl); + permerror (" from definition of %q+#D", tmpl); return false; } } @@ -728,9 +728,9 @@ namespace of its template. */ ns = decl_namespace_context (spec); if (!is_ancestor (current_namespace, ns)) - pedwarn ("explicit instantiation of %qD in namespace %qD " - "(which does not enclose namespace %qD)", - spec, current_namespace, ns); + permerror ("explicit instantiation of %qD in namespace %qD " + "(which does not enclose namespace %qD)", + spec, current_namespace, ns); } /* The TYPE is being declared. If it is a template type, that means it @@ -811,9 +811,9 @@ if (current_namespace != decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type))) { - pedwarn ("specializing %q#T in different namespace", type); - pedwarn (" from definition of %q+#D", - CLASSTYPE_TI_TEMPLATE (type)); + permerror ("specializing %q#T in different namespace", type); + permerror (" from definition of %q+#D", + CLASSTYPE_TI_TEMPLATE (type)); } /* Check for invalid specialization after instantiation: @@ -2006,7 +2006,7 @@ for (; t; t = TREE_CHAIN (t)) if (TREE_PURPOSE (t)) { - pedwarn + permerror ("default argument specified in explicit specialization"); break; } @@ -4942,8 +4942,8 @@ if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF && TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM) { - pedwarn ("to refer to a type member of a template parameter, " - "use %", orig_arg); + permerror ("to refer to a type member of a template parameter, " + "use %", orig_arg); orig_arg = make_typename_type (TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1), @@ -14567,7 +14567,7 @@ the first instantiation was `extern' and the second is not, and EXTERN_P for the opposite case. */ if (DECL_NOT_REALLY_EXTERN (result) && !extern_p) - pedwarn ("duplicate explicit instantiation of %q#D", result); + permerror ("duplicate explicit instantiation of %q#D", result); /* If an "extern" explicit instantiation follows an ordinary explicit instantiation, the template is instantiated. */ if (extern_p) @@ -14580,7 +14580,7 @@ } else if (!DECL_TEMPLATE_INFO (result)) { - pedwarn ("explicit instantiation of non-template %q#D", result); + permerror ("explicit instantiation of non-template %q#D", result); return; } @@ -14721,7 +14721,7 @@ if (!previous_instantiation_extern_p && !extern_p && (complain & tf_error)) - pedwarn ("duplicate explicit instantiation of %q#T", t); + permerror ("duplicate explicit instantiation of %q#T", t); /* If we've already instantiated the template, just return now. */ if (!CLASSTYPE_INTERFACE_ONLY (t)) @@ -15168,7 +15168,7 @@ member function or static data member of a class template shall be present in every translation unit in which it is explicitly instantiated. */ - pedwarn + permerror ("explicit instantiation of %qD but no definition available", d); /* ??? Historically, we have instantiated inline functions, even Index: gcc/cp/semantics.c =================================================================== --- gcc/cp/semantics.c (revision 136847) +++ gcc/cp/semantics.c (working copy) @@ -2170,7 +2170,7 @@ { if (aggr != class_type_node) { - pedwarn ("template type parameters must use the keyword % or %"); + permerror ("template type parameters must use the keyword % or %"); aggr = class_type_node; } Index: gcc/cp/name-lookup.c =================================================================== --- gcc/cp/name-lookup.c (revision 136847) +++ gcc/cp/name-lookup.c (working copy) @@ -846,8 +846,8 @@ && TREE_CODE (decl) == TREE_CODE (x) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) { - pedwarn ("type mismatch with previous external decl of %q#D", x); - pedwarn ("previous external decl of %q+#D", decl); + permerror ("type mismatch with previous external decl of %q#D", x); + permerror ("previous external decl of %q+#D", decl); } } @@ -1165,7 +1165,7 @@ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl))) { - error ("name lookup of %qD changed for new ISO % scoping", + error ("name lookup of %qD changed for ISO % scoping", DECL_NAME (decl)); error (" cannot use obsolete binding at %q+D because " "it has a destructor", decl); @@ -1173,9 +1173,19 @@ } else { - pedwarn ("name lookup of %qD changed for new ISO % scoping", - DECL_NAME (decl)); - pedwarn (" using obsolete binding at %q+D", decl); + permerror ("name lookup of %qD changed for ISO % scoping", + DECL_NAME (decl)); + if (flag_permissive) + permerror (" using obsolete binding at %q+D", decl); + else + { + static bool hint; + if (!hint) + { + inform ("(if you use %<-fpermissive%> G++ will accept your code)"); + hint = true; + } + } } return decl; Index: gcc/cp/decl2.c =================================================================== --- gcc/cp/decl2.c (revision 136847) +++ gcc/cp/decl2.c (working copy) @@ -716,8 +716,8 @@ VEC_safe_push (tree, gc, pending_statics, decl); if (LOCAL_CLASS_P (current_class_type)) - pedwarn ("local class %q#T shall not have static data member %q#D", - current_class_type, decl); + permerror ("local class %q#T shall not have static data member %q#D", + current_class_type, decl); /* Static consts need not be initialized in the class definition. */ if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))) @@ -1233,15 +1233,15 @@ continue; if (TREE_CODE (field) != FIELD_DECL) { - pedwarn ("%q+#D invalid; an anonymous union can only " - "have non-static data members", field); + permerror ("%q+#D invalid; an anonymous union can only " + "have non-static data members", field); continue; } if (TREE_PRIVATE (field)) - pedwarn ("private member %q+#D in anonymous union", field); + permerror ("private member %q+#D in anonymous union", field); else if (TREE_PROTECTED (field)) - pedwarn ("protected member %q+#D in anonymous union", field); + permerror ("protected member %q+#D in anonymous union", field); if (processing_template_decl) ref = build_min_nt (COMPONENT_REF, object, @@ -1376,8 +1376,8 @@ e = 2; if (e == 2) - pedwarn ("% takes type % (%qT) " - "as first parameter", size_type_node); + permerror ("% takes type % (%qT) " + "as first parameter", size_type_node); switch (e) { Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 136847) +++ gcc/cp/parser.c (working copy) @@ -4111,10 +4111,10 @@ && !(TREE_CODE (new_scope) == TYPENAME_TYPE && (TREE_CODE (TYPENAME_TYPE_FULLNAME (new_scope)) == TEMPLATE_ID_EXPR))) - pedwarn (TYPE_P (new_scope) - ? "%qT is not a template" - : "%qD is not a template", - new_scope); + permerror (TYPE_P (new_scope) + ? "%qT is not a template" + : "%qD is not a template", + new_scope); /* If it is a class scope, try to complete it; we are about to be looking up names inside the class. */ if (TYPE_P (new_scope) @@ -8928,7 +8928,7 @@ /* Find out what is being initialized. */ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN)) { - pedwarn ("anachronistic old-style base class initializer"); + permerror ("anachronistic old-style base class initializer"); mem_initializer_id = NULL_TREE; } else @@ -9845,7 +9845,7 @@ static bool hint; if (!hint) { - inform ("(if you use -fpermissive G++ will accept your code)"); + inform ("(if you use %<-fpermissive%> G++ will accept your code)"); hint = true; } } @@ -11186,7 +11186,7 @@ tag_type = typename_type; /* The `typename' keyword is only allowed in templates. */ if (!processing_template_decl) - pedwarn ("using % outside of template"); + permerror ("using % outside of template"); } /* Otherwise it must be a class-key. */ else @@ -13865,7 +13865,7 @@ if (!parser->default_arg_ok_p) { - if (!flag_pedantic_errors) + if (flag_permissive) warning (0, "deprecated use of default argument for parameter of non-function"); else { @@ -14758,7 +14758,7 @@ class member of a namespace outside of its namespace. */ if (scope == nested_name_specifier) { - pedwarn ("extra qualification ignored"); + permerror ("extra qualification not allowed"); nested_name_specifier = NULL_TREE; num_templates = 0; } @@ -18121,7 +18121,7 @@ cp_parser_check_class_key (enum tag_types class_key, tree type) { if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type)) - pedwarn ("%qs tag used in naming %q#T", + permerror ("%qs tag used in naming %q#T", class_key == union_type ? "union" : class_key == record_type ? "struct" : "class", type);