continue;
}
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (method),
"%q#D conflicts with version inherited from %qT",
method, basef);
}
else
{
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (method),
"%q#D cannot be overloaded with %q#D", method, fn);
inform (DECL_SOURCE_LOCATION (fn),
;
else if (is_overloaded_fn (old_value))
{
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (using_decl), "%qD invalid in %q#T "
"because of local method %q#D with same name",
using_decl, t, old_value);
}
else if (!DECL_ARTIFICIAL (old_value))
{
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (using_decl), "%qD invalid in %q#T "
"because of local member %q#D with same name",
using_decl, t, old_value);
if (!nonprivate_ctor)
{
+ auto_diagnostic_group d;
bool w = warning (OPT_Wctor_dtor_privacy,
"%q#T only defines private constructors and has "
"no friends", t);
if (TREE_CODE (t) == UNION_TYPE && cxx_dialect < cxx11)
{
static bool warned;
+ auto_diagnostic_group d;
int oldcount = errorcount;
if (TYPE_NEEDS_CONSTRUCTING (type))
error ("member %q+#D with constructor not allowed in union",
if (default_init_member
&& TREE_CODE (t) == UNION_TYPE)
{
+ auto_diagnostic_group d;
error ("multiple fields in union %qT initialized", t);
inform (DECL_SOURCE_LOCATION (default_init_member),
"initialized member %q+D declared here",
&& TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
&& !(TYPE_HAS_COPY_CTOR (t) && TYPE_HAS_COPY_ASSIGN (t)))
{
+ auto_diagnostic_group d;
if (warning (OPT_Weffc__, "%q#T has pointer data members", t))
{
if (! TYPE_HAS_COPY_CTOR (t))
/* There were *no* matches. */
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("no matches converting function %qD to type %q#T",
OVL_NAME (overload), target_type);
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("converting overloaded function %qD to type %q#T is ambiguous",
OVL_NAME (overload), target_type);
else
/* Make it an error. */
global_dc->m_pedantic_errors = 1;
+
+ auto_diagnostic_group d;
if (pedwarn (location_of (decl), OPT_Wchanges_meaning,
"declaration of %q#D changes meaning of %qD",
decl, OVL_NAME (decl)))
}
if (!equivalent_constraints (ci, orig_ci))
{
+ auto_diagnostic_group d;
error ("%qT does not match original declaration", type);
tree tmpl = CLASSTYPE_TI_TEMPLATE (type);
location_t loc = DECL_SOURCE_LOCATION (tmpl);
break;
case CPTK_IS_CONSTRUCTIBLE:
if (!t2)
- inform (loc, " %qT is not default constructible", t1);
+ inform (loc, " %qT is not default constructible", t1);
else
- inform (loc, " %qT is not constructible from %qE", t1, t2);
+ inform (loc, " %qT is not constructible from %qE", t1, t2);
break;
case CPTK_IS_CONVERTIBLE:
inform (loc, " %qT is not convertible from %qE", t2, t1);
break;
case CPTK_IS_INVOCABLE:
if (!t2)
- inform (loc, " %qT is not invocable", t1);
+ inform (loc, " %qT is not invocable", t1);
else
- inform (loc, " %qT is not invocable by %qE", t1, t2);
+ inform (loc, " %qT is not invocable by %qE", t1, t2);
break;
case CPTK_IS_LAYOUT_COMPATIBLE:
inform (loc, " %qT is not layout compatible with %qT", t1, t2);
inform (loc, " %qT is not nothrow constructible from %qE", t1, t2);
break;
case CPTK_IS_NOTHROW_CONVERTIBLE:
- inform (loc, " %qT is not nothrow convertible from %qE", t2, t1);
+ inform (loc, " %qT is not nothrow convertible from %qE", t2, t1);
break;
case CPTK_IS_NOTHROW_INVOCABLE:
- if (!t2)
- inform (loc, " %qT is not nothrow invocable", t1);
- else
- inform (loc, " %qT is not nothrow invocable by %qE", t1, t2);
- break;
+ if (!t2)
+ inform (loc, " %qT is not nothrow invocable", t1);
+ else
+ inform (loc, " %qT is not nothrow invocable by %qE", t1, t2);
+ break;
case CPTK_IS_OBJECT:
inform (loc, " %qT is not an object type", t1);
break;
{
if (!traits_error_emitted)
{
+ auto_diagnostic_group d;
gcc_rich_location richloc (kw);
error_at (&richloc, "coroutines require a traits template; cannot"
" find %<%E::%E%>", std_node, coro_traits_identifier);
tf_none);
if (has_ret_void && has_ret_val)
{
+ auto_diagnostic_group d;
location_t ploc = DECL_SOURCE_LOCATION (fndecl);
if (!coro_info->coro_co_return_error_emitted)
error_at (ploc, "the coroutine promise type %qT declares both"
{
if (!TYPE_NOTHROW_P (TREE_TYPE (fndecl)))
{
+ auto_diagnostic_group d;
location_t f_loc = cp_expr_loc_or_loc (fndecl,
DECL_SOURCE_LOCATION (fndecl));
error_at (f_loc, "the expression %qE is required to be non-throwing",
{
if (complain)
{
+ auto_diagnostic_group d;
error ("ambiguous default type conversion from %qT",
basetype);
inform (input_location,
if (DECL_IMMEDIATE_FUNCTION_P (old_decl)
|| DECL_IMMEDIATE_FUNCTION_P (new_decl))
kind = "consteval";
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (new_decl),
"redeclaration %qD differs in %qs "
"from previous declaration", new_decl,
if (template_heads_equivalent_p (newdecl, olddecl)
&& function_requirements_equivalent_p (newres, oldres))
{
+ auto_diagnostic_group d;
error ("ambiguating new declaration %q+#D", newdecl);
inform (DECL_SOURCE_LOCATION (olddecl),
"old declaration %q#D", olddecl);
return NULL_TREE;
/* There can only be one! */
+ auto_diagnostic_group d;
if (TREE_CODE (newdecl) == TEMPLATE_DECL
&& check_raw_literal_operator (olddecl))
error_at (newdecl_loc,
/* One is an implicit typedef, that's ok. */
return NULL_TREE;
+ auto_diagnostic_group d;
error ("%q#D redeclared as different kind of entity", newdecl);
inform (olddecl_loc, "previous declaration %q#D", olddecl);
if (TREE_CODE (oldres) == TYPE_DECL
|| TREE_CODE (newres) == TYPE_DECL)
{
+ auto_diagnostic_group d;
error_at (newdecl_loc,
"conflicting declaration of template %q#D", newdecl);
inform (olddecl_loc,
{
if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl))
{
+ auto_diagnostic_group d;
error_at (newdecl_loc,
"conflicting declaration of C function %q#D",
newdecl);
// And the same constraints.
&& equivalently_constrained (newdecl, olddecl))
{
+ auto_diagnostic_group d;
error_at (newdecl_loc,
"ambiguating new declaration of %q#D", newdecl);
inform (olddecl_loc,
}
else
{
+ auto_diagnostic_group d;
error_at (newdecl_loc, "conflicting declaration %q#D", newdecl);
inform (olddecl_loc,
"previous declaration as %q#D", olddecl);
{
/* OMP UDRs are never duplicates. */
gcc_assert (DECL_OMP_DECLARE_REDUCTION_P (olddecl));
+ auto_diagnostic_group d;
error_at (newdecl_loc,
"redeclaration of %<pragma omp declare reduction%>");
inform (olddecl_loc,
{
if (merge_attr)
{
- if (diagnose_mismatched_attributes (olddecl, newdecl))
- inform (olddecl_loc, DECL_INITIAL (olddecl)
- ? G_("previous definition of %qD here")
- : G_("previous declaration of %qD here"), olddecl);
+ {
+ auto_diagnostic_group d;
+ if (diagnose_mismatched_attributes (olddecl, newdecl))
+ inform (olddecl_loc, DECL_INITIAL (olddecl)
+ ? G_("previous definition of %qD here")
+ : G_("previous declaration of %qD here"), olddecl);
+ }
/* [dcl.attr.noreturn]: The first declaration of a function shall
specify the noreturn attribute if any declaration of that function
&& cxx11_attribute_p (a)
&& get_attribute_namespace (a) == NULL_TREE)
{
+ auto_diagnostic_group d;
error_at (newdecl_loc, "function %qD declared %<[[noreturn]]%> "
"but its first declaration was not", newdecl);
inform (olddecl_loc, "previous declaration of %qD", olddecl);
if (old->binding_level == current_binding_level)
{
+ auto_diagnostic_group d;
error ("local label %qE conflicts with existing label", id);
inform (DECL_SOURCE_LOCATION (old->label_decl), "previous label");
return NULL;
bool exited_omp, const location_t *locus,
vec<tree,va_gc> *computed)
{
+ auto_diagnostic_group d;
cp_binding_level *b;
bool complained = false;
int identified = 0;
void
check_goto_1 (named_label_entry *ent, bool computed)
{
+ auto_diagnostic_group d;
tree decl = ent->label_decl;
/* If the label hasn't been defined yet, defer checking. */
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("lookup of %qT in %qT is ambiguous", name, context);
print_candidates (t);
}
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("template parameters do not match template %qD", tmpl);
inform (DECL_SOURCE_LOCATION (tmpl),
"%qD declared here", tmpl);
No attribute-specifier-seq shall appertain to an explicit
instantiation. */
{
+ auto_diagnostic_group d;
if (warning_at (loc, OPT_Wattributes,
"attribute ignored in explicit instantiation %q#T",
declared_type))
/* OK, specialization was already checked. */;
else if (variable_template_p (field) && !this_tmpl)
{
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (decl),
"non-member-template declaration of %qD", decl);
inform (DECL_SOURCE_LOCATION (field), "does not match "
msg = G_("sorry: semantics of inline function "
"static data %q#D are wrong (you%'ll wind "
"up with multiple copies)");
+ auto_diagnostic_group d;
if (warning_at (DECL_SOURCE_LOCATION (decl), 0,
msg, decl))
inform (DECL_SOURCE_LOCATION (decl),
if (!field)
return true;
+ auto_diagnostic_group d;
bool show_notes = true;
if (!constexpr_context_p || cxx_dialect >= cxx20)
{
if (field && TREE_CODE (field) == TREE_LIST)
{
+ auto_diagnostic_group g;
error ("request for member %qD is ambiguous",
d->cur->index);
print_candidates (field);
{
static int explained = 0;
+ auto_diagnostic_group d;
if (cxx_dialect < cxx11)
error ("initializer invalid for static member with constructor");
else if (cxx_dialect < cxx17)
&& !type_uses_auto (type)
&& !COMPLETE_TYPE_P (complete_type (type)))
{
+ auto_diagnostic_group d;
error_at (location_of (decl),
"deduced type %qT for %qD is incomplete", type, decl);
cxx_incomplete_type_inform (type);
complete_type (TREE_TYPE (decl));
if (!omp_mappable_type (TREE_TYPE (decl)))
{
+ auto_diagnostic_group d;
error ("%q+D in declare target directive does not have mappable"
" type", decl);
if (TREE_TYPE (decl) != error_mark_node
return type;
else if (ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
+ auto_diagnostic_group d;
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE)
error_at (loc, "cannot decompose class type %qT because it has an "
"anonymous struct member", type);
}
else if (!accessible_p (type, field, true))
{
+ auto_diagnostic_group d;
error_at (loc, "cannot decompose inaccessible member %qD of %qT",
field, type);
inform (DECL_SOURCE_LOCATION (field),
if (count != eltscnt)
{
cnt_mismatch:
+ auto_diagnostic_group d;
if (count > eltscnt)
error_n (loc, count,
"%u name provided for structured binding",
}
if (!tree_fits_uhwi_p (tsize))
{
+ auto_diagnostic_group d;
error_n (loc, count,
"%u name provided for structured binding",
"%u names provided for structured binding", count);
if (CP_DECL_THREAD_LOCAL_P (decl) && DECL_GNU_TLS_P (decl)
&& !DECL_FUNCTION_SCOPE_P (decl))
{
+ auto_diagnostic_group d;
location_t dloc = DECL_SOURCE_LOCATION (decl);
if (init)
error_at (dloc, "non-local variable %qD declared %<__thread%> "
if (in_namespace == NULL_TREE
&& CP_DECL_CONTEXT (decl) != CP_TYPE_CONTEXT (type))
{
+ auto_diagnostic_group d;
error_at (location, "deduction guide %qD must be declared in the "
"same scope as %qT", decl, type);
inform (location_of (type), " declared here");
if (DECL_CLASS_SCOPE_P (decl)
&& current_access_specifier != declared_access (TYPE_NAME (type)))
{
+ auto_diagnostic_group d;
error_at (location, "deduction guide %qD must have the same access "
"as %qT", decl, type);
inform (location_of (type), " declared here");
/* [over.literal]/6: Literal operators shall not have C linkage. */
if (DECL_LANGUAGE (decl) == lang_c)
{
+ auto_diagnostic_group d;
error_at (location, "literal operator with C linkage");
maybe_show_extern_c_location ();
return NULL_TREE;
}
else if (DECL_DEFAULTED_FN (old_decl))
{
+ auto_diagnostic_group d;
error ("definition of explicitly-defaulted %q+D", decl);
inform (DECL_SOURCE_LOCATION (old_decl),
"%q#D explicitly defaulted here", old_decl);
&& !diagnose_misapplied_contracts (declspecs->std_attributes))
{
location_t attr_loc = declspecs->locations[ds_std_attribute];
+ auto_diagnostic_group d;
if (any_nonignored_attribute_p (declspecs->std_attributes)
&& warning_at (attr_loc, OPT_Wattributes, "attribute ignored"))
inform (attr_loc, "an attribute that appertains to a type-specifier "
&& (MAYBE_CLASS_TYPE_P (type)
|| TREE_CODE (type) == ENUMERAL_TYPE)))
{
+ auto_diagnostic_group d;
if (warning_at (declarator->parenthesized, OPT_Wparentheses,
"unnecessary parentheses in declaration of %qs",
name))
/* OK for C++11 lambdas. */;
else if (cxx_dialect < cxx14)
{
+ auto_diagnostic_group d;
error_at (typespec_loc, "%qs function uses "
"%<auto%> type specifier without "
"trailing return type", name);
}
else if (!late_return_type)
{
+ auto_diagnostic_group d;
error_at (declarator->id_loc, "deduction guide "
"for %qT must have trailing return "
"type", TREE_TYPE (tmpl));
tree tmpl = TREE_OPERAND (unqualified_id, 0);
if (variable_template_p (tmpl))
{
+ auto_diagnostic_group d;
error_at (id_loc, "specialization of variable template "
"%qD declared as function", tmpl);
inform (DECL_SOURCE_LOCATION (tmpl),
{
if (unqualified_id)
{
+ auto_diagnostic_group d;
error_at (id_loc, "field %qD has incomplete type %qT",
unqualified_id, type);
cxx_incomplete_type_inform (strip_array_types (type));
&& !all_attributes_are_contracts_p (*attrlist))
{
*attrlist = NULL_TREE;
+ auto_diagnostic_group d;
if (warning_at (id_loc, OPT_Wattributes, "attribute ignored"))
inform (id_loc, "an attribute that appertains to a friend "
"declaration that is not a definition is ignored");
&& !DECL_SELF_REFERENCE_P (decl)
&& tag_code != typename_type)
{
+ auto_diagnostic_group d;
if (alias_template_specialization_p (type, nt_opaque))
error ("using alias template specialization %qT after %qs",
type, tag_name (tag_code));
&& tag_code != enum_type
&& tag_code != typename_type)
{
+ auto_diagnostic_group d;
error ("%qT referred to as %qs", type, tag_name (tag_code));
inform (location_of (type), "%qT has a previous declaration here", type);
return error_mark_node;
else if (TREE_CODE (type) != ENUMERAL_TYPE
&& tag_code == enum_type)
{
+ auto_diagnostic_group d;
error ("%qT referred to as enum", type);
inform (location_of (type), "%qT has a previous declaration here", type);
return error_mark_node;
if (TREE_CODE (decl) == TREE_LIST)
{
+ auto_diagnostic_group d;
error ("reference to %qD is ambiguous", name);
print_candidates (decl);
return error_mark_node;
&& !template_header_p
&& how == TAG_how::CURRENT_ONLY)
{
+ auto_diagnostic_group d;
error ("class template %qD redeclared as non-template", name);
inform (location_of (decl), "previous declaration here");
CLASSTYPE_ERRONEOUS (TREE_TYPE (decl)) = true;
&& (!CLASSTYPE_TEMPLATE_INFO (t)
|| (!PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))))
{
+ auto_diagnostic_group d;
error ("%qT is not a template", t);
inform (location_of (t), "previous declaration here");
if (TYPE_CLASS_SCOPE_P (t)
&& CLASS_TYPE_P (t)
&& CLASSTYPE_IS_TEMPLATE (t))
{
+ auto_diagnostic_group d;
error ("redeclaration of %qT as a non-template", t);
inform (location_of (t), "previous declaration %qD", t);
return error_mark_node;
NULL_TREE, false, NULL);
if (!OPAQUE_ENUM_P (enumtype))
{
+ auto_diagnostic_group d;
error_at (loc, "multiple definition of %q#T", enumtype);
inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
"previous definition here");
else if (!current_function_returns_value
&& !current_function_returns_null)
{
+ auto_diagnostic_group d;
error ("no return statements in function returning %qT",
DECL_SAVED_AUTO_RETURN_TYPE (fndecl));
inform (input_location, "only plain %<auto%> return type can be "
if (DECL_CONV_FN_P (function))
fns = get_class_binding (ctype, conv_op_identifier);
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (function),
"no declaration matches %q#D", function);
if (fns)
*slot = decl;
else if (need_warning)
{
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (decl),
"mangling of %q#D as %qE conflicts with a previous mangle",
decl, id);
sorry ("converting lambda that uses %<...%> to function pointer");
else if (complain & tf_error)
{
+ auto_diagnostic_group d;
if (DECL_INITIAL (decl)
&& TREE_CODE (DECL_INITIAL (decl)) == STRING_CST)
{
scope);
else if (TREE_CODE (decl) == TREE_LIST)
{
+ auto_diagnostic_group d;
error_at (location, "reference to %<%T::%D%> is ambiguous",
scope, name);
print_candidates (decl);
}
else
{
+ auto_diagnostic_group d;
name_hint hint;
if (SCOPED_ENUM_P (scope) && TREE_CODE (name) == IDENTIFIER_NODE)
hint = suggest_alternative_in_scoped_enum (name, scope);
exp = moved;
/* Call the copy constructor. */
+ auto_diagnostic_group d;
releasing_vec exp_vec (make_tree_vector_single (exp));
exp = build_special_member_call (object, complete_ctor_identifier,
&exp_vec, TREE_TYPE (object), flags,
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("default member initializer for %qD required before the end "
"of its enclosing class", member);
inform (location_of (init), "defined here");
++ error_count;
if (complain)
{
+ auto_diagnostic_group d;
if (DECL_CONTEXT (field) == origin)
{
if (using_new)
++ error_count;
if (complain)
{
+ auto_diagnostic_group d;
if (DECL_CONTEXT (field) == origin)
{
if (using_new)
bool warned = false;
if (nelts)
nelts = fold_for_warn (nelts);
+
+ auto_diagnostic_group d;
if (nelts)
if (CONSTANT_CLASS_P (nelts))
warned = warning_at (loc, OPT_Wplacement_new_,
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("request for member %qD is ambiguous", fnname);
print_candidates (fns);
}
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
int saved_errorcount = errorcount;
if (permerror_opt (loc, OPT_Wdelete_incomplete,
"operator %<delete []%> used on "
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
int saved_errorcount = errorcount;
if (permerror_opt (loc, OPT_Wdelete_incomplete,
"operator %<delete%> used on "
else if (!dependent_type_p (type)
&& variably_modified_type_p (type, NULL_TREE))
{
+ auto_diagnostic_group d;
sorry ("capture of variably-modified type %qT that is not an N3639 array "
"of runtime bound", type);
if (TREE_CODE (type) == ARRAY_TYPE
type = complete_type (type);
if (!COMPLETE_TYPE_P (type))
{
+ auto_diagnostic_group d;
error ("capture by copy of incomplete type %qT", type);
cxx_incomplete_type_inform (type);
return error_mark_node;
&& this_capture_p
&& LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda) == CPLD_COPY)
{
+ auto_diagnostic_group d;
if (warning_at (LAMBDA_EXPR_LOCATION (lambda), OPT_Wdeprecated,
"implicit capture of %qE via %<[=]%> is deprecated "
"in C++20", this_identifier))
Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */
+ auto_diagnostic_group d;
permerror (loc, "there are no arguments to %qD that depend on a template "
"parameter, so a declaration of %qD must be available",
name, name);
int error_count = errorcount;
int warning_count = warningcount + werrorcount;
special_function_kind sfk = special_function_p (fndecl);
+ auto_diagnostic_group d;
/* Reset the source location, we might have been previously
deferred, and thus have saved where we were first needed. */
TREE_TYPE (TREE_TYPE (implicit_fn)))
|| !compare_fn_params (fn, implicit_fn))
{
+ auto_diagnostic_group d;
error ("defaulted declaration %q+D does not match the "
"expected signature", fn);
inform (DECL_SOURCE_LOCATION (fn),
{
if (!CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
{
+ auto_diagnostic_group d;
error ("explicitly defaulted function %q+D cannot be declared "
"%qs because the implicit declaration is not %qs:", fn,
DECL_IMMEDIATE_FUNCTION_P (fn) ? "consteval" : "constexpr",
{
// FIXME:QOI Might be template specialization from a module,
// not necessarily global module
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (decl),
"conflicting global module declaration %#qD", decl);
inform (DECL_SOURCE_LOCATION (existing),
if (known || values)
{
+ auto_diagnostic_group d;
error_at (DECL_SOURCE_LOCATION (maybe_dup),
"definition of %qD does not match", maybe_dup);
inform (DECL_SOURCE_LOCATION (defn),
if (imp == this)
{
/* Cannot import the current module. */
+ auto_diagnostic_group d;
error_at (from, "cannot import module in its own purview");
inform (loc, "module %qs declared here", get_flatname ());
return false;
{
/* If LOC is the first loc, this is the end of file check, which
is a warning. */
+ auto_diagnostic_group d;
if (loc == MAP_START_LOCATION (LINEMAPS_ORDINARY_MAP_AT (line_table, 0)))
warning_at (loc, OPT_Winvalid_imported_macros,
"inconsistent imported macro definition %qE",
/* Reject when either is non-experimental or when experimental
major versions differ. */
+ auto_diagnostic_group d;
bool reject_p = ((!IS_EXPERIMENTAL (my_ver)
|| !IS_EXPERIMENTAL (their_ver)
|| MODULE_MAJOR (my_ver) != MODULE_MAJOR (their_ver))
if (int e = from ()->get_error ())
{
+ auto_diagnostic_group d;
error_at (loc, "failed to read compiled module: %s",
from ()->get_error (filename));
note_cmi_name ();
module_state *current = (*modules)[0];
if (module_purview_p () || module->loadedness > ML_CONFIG)
{
+ auto_diagnostic_group d;
error_at (from_loc, module_purview_p ()
? G_("module already declared")
: G_("module already imported"));
|| (cpp_opts->deps.style != DEPS_NONE
&& !cpp_opts->deps.need_preprocessor_output))
{
+ auto_diagnostic_group d;
warning (0, flag_dump_macros == 'M'
? G_("macro debug output may be incomplete with modules")
: G_("module dependencies require preprocessing"));
void
diagnose_name_conflict (tree decl, tree bval)
{
+ auto_diagnostic_group d;
if (TREE_CODE (decl) == TREE_CODE (bval)
&& TREE_CODE (decl) != NAMESPACE_DECL
&& !DECL_DECLARES_FUNCTION_P (decl)
/* We can (independently) have ambiguous implicit typedefs. */
|| (lookup.type && TREE_CODE (lookup.type) == TREE_LIST))
{
+ auto_diagnostic_group d;
error ("reference to %qD is ambiguous", lookup.name);
print_candidates (TREE_CODE (lookup.value) == TREE_LIST
? lookup.value : lookup.type);
if (TREE_CODE (old) == TREE_LIST)
{
ambiguous:
+ auto_diagnostic_group d;
DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
error ("reference to %qD is ambiguous", decl);
print_candidates (old);
{
if (hidden_p)
{
+ auto_diagnostic_group d;
pedwarn (DECL_SOURCE_LOCATION (decl), 0,
"%qD has not been declared within %qD", decl, scope);
inform (DECL_SOURCE_LOCATION (found),
if (current_binding_level->kind == sk_namespace
&& is_attribute_p ("strong", name))
{
+ auto_diagnostic_group d;
if (warning (0, "%<strong%> using directive no longer supported")
&& CP_DECL_CONTEXT (target) == current_namespace)
inform (DECL_SOURCE_LOCATION (target),
if (make_inline && !DECL_NAMESPACE_INLINE_P (ns))
{
+ auto_diagnostic_group d;
error_at (input_location,
"inline namespace must be specified at initial definition");
inform (DECL_SOURCE_LOCATION (ns), "%qD defined here", ns);
}
else if (DECL_NAMESPACE_INLINE_P (decl) != inline_p)
{
+ auto_diagnostic_group d;
error_at (loc, "%s namespace %qD conflicts with reachable definition",
inline_p ? "inline" : "non-inline", decl);
inform (DECL_SOURCE_LOCATION (decl), "reachable %s definition here",
if (declarator
&& declarator->kind == cdk_function)
{
+ auto_diagnostic_group d;
error_at (type_location,
"new types may not be defined in a return type");
inform (type_location,
}
}
- bool complained
- = emit_diagnostic (kind, input_location, opt,
- "unable to find numeric literal operator %qD", name);
-
- if (!complained)
- /* Don't inform either. */;
- else if (i14)
- {
- inform (token->location, "add %<using namespace std::complex_literals%> "
- "(from %<<complex>%>) to enable the C++14 user-defined literal "
- "suffixes");
- if (ext)
- inform (token->location, "or use %<j%> instead of %<i%> for the "
- "GNU built-in suffix");
- }
- else if (!ext)
- inform (token->location, "use %<-fext-numeric-literals%> "
- "to enable more built-in suffixes");
+ {
+ auto_diagnostic_group d;
+ bool complained
+ = emit_diagnostic (kind, input_location, opt,
+ "unable to find numeric literal operator %qD", name);
+
+ if (!complained)
+ /* Don't inform either. */;
+ else if (i14)
+ {
+ inform (token->location, "add %<using namespace std::complex_literals%> "
+ "(from %<<complex>%>) to enable the C++14 user-defined literal "
+ "suffixes");
+ if (ext)
+ inform (token->location, "or use %<j%> instead of %<i%> for the "
+ "GNU built-in suffix");
+ }
+ else if (!ext)
+ inform (token->location, "use %<-fext-numeric-literals%> "
+ "to enable more built-in suffixes");
+ }
if (kind == DK_ERROR)
value = error_mark_node;
if (TREE_CODE (tid) == TEMPLATE_ID_EXPR
&& TREE_CODE (TREE_OPERAND (tid, 0)) != IDENTIFIER_NODE)
{
+ auto_diagnostic_group d;
tree tmpl = NULL_TREE;
if (is_overloaded_fn (tid))
{
message for this case. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
{
- error_at (token->location,
- "array bound forbidden after parenthesized type-id");
- inform (token->location,
- "try removing the parentheses around the type-id");
+ {
+ auto_diagnostic_group d;
+ error_at (token->location,
+ "array bound forbidden after parenthesized type-id");
+ inform (token->location,
+ "try removing the parentheses around the type-id");
+ }
cp_parser_direct_new_declarator (parser);
}
}
&& token->type == CPP_RSHIFT
&& !parser->greater_than_is_operator_p)
{
+ auto_diagnostic_group d;
if (warning_at (token->location, OPT_Wc__11_compat,
"%<>>%> operator is treated"
" as two right angle brackets in C++11"))
else if (!VAR_P (capture_init_expr)
&& TREE_CODE (capture_init_expr) != PARM_DECL)
{
+ auto_diagnostic_group d;
error_at (capture_token->location,
"capture of non-variable %qE",
capture_init_expr);
if (VAR_P (capture_init_expr)
&& decl_storage_duration (capture_init_expr) != dk_auto)
{
+ auto_diagnostic_group d;
if (pedwarn (capture_token->location, 0, "capture of variable "
"%qD with non-automatic storage duration",
capture_init_expr))
}
else if (scope != global_namespace)
{
+ auto_diagnostic_group d;
error_at (token->location, "module-declaration must be at global scope");
inform (DECL_SOURCE_LOCATION (scope), "scope opened here");
goto skip_eol;
if (mp_state == MP_PURVIEW || mp_state == MP_PRIVATE)
{
+ auto_diagnostic_group d;
error_at (token->location, "post-module-declaration"
" imports must be contiguous");
- note_lexer:
inform (token->location, "perhaps insert a line break after"
" %<import%>, or other disambiguation, to prevent this"
" being considered a module control-line");
- skip_eol:
cp_parser_skip_to_pragma_eol (parser, token);
}
else if (current_scope () != global_namespace)
{
+ auto_diagnostic_group d;
error_at (token->location, "import-declaration must be at global scope");
- goto note_lexer;
+ inform (token->location, "perhaps insert a line break after"
+ " %<import%>, or other disambiguation, to prevent this"
+ " being considered a module control-line");
+ cp_parser_skip_to_pragma_eol (parser, token);
}
else
{
tree attrs = cp_parser_attributes_opt (parser);
if (!mod || !cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON))
- goto skip_eol;
+ {
+ cp_parser_skip_to_pragma_eol (parser, token);
+ return;
+ }
cp_parser_require_pragma_eol (parser, token);
if (mp_state == MP_PURVIEW_IMPORTS || mp_state == MP_PRIVATE_IMPORTS)
if (!c_dialect_objc ())
{
location_t where = get_finish (t2->location);
+ auto_diagnostic_group d;
warning_at (token1->location, OPT_Wattributes, "attributes are"
" not permitted in this position");
where = linemap_position_for_loc_and_offset (line_table,
if (decl_specs->std_attributes)
{
+ auto_diagnostic_group d;
error_at (decl_specs->locations[ds_std_attribute],
"standard attributes in middle of decl-specifiers");
inform (decl_specs->locations[ds_std_attribute],
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
+ auto_diagnostic_group d;
if (permerror (next_token->location,
"%<<::%> cannot begin a template-argument list"))
{
/* C++20 says that "function-name < a;" is now ill-formed. */
if (cp_parser_error_occurred (parser))
{
+ auto_diagnostic_group d;
error_at (token->location, "invalid template-argument-list");
inform (token->location, "function name as the left hand "
"operand of %<<%> is ill-formed in C++20; wrap the "
cp_token_position start = 0;
/* Explain what went wrong. */
- error_at (token->location, "non-template %qD used as template",
- identifier);
- inform (token->location, "use %<%T::template %D%> to indicate that it is a template",
- parser->scope, identifier);
+ {
+ auto_diagnostic_group d;
+ error_at (token->location, "non-template %qD used as template",
+ identifier);
+ inform (token->location, "use %<%T::template %D%> to indicate "
+ "that it is a template", parser->scope, identifier);
+ }
/* If parsing tentatively, find the location of the "<" token. */
if (cp_parser_simulate_error (parser))
start = cp_lexer_token_position (parser->lexer, true);
bool need_lang_pop = current_lang_name == lang_name_c;
if (need_lang_pop)
{
+ auto_diagnostic_group d;
error_at (token->location, "template specialization with C linkage");
maybe_show_extern_c_location ();
{
if (!tentative)
{
+ auto_diagnostic_group d;
error_at (loc, "%qE does not constrain a type", DECL_NAME (con));
inform (DECL_SOURCE_LOCATION (con), "concept defined here");
}
"attributes ignored on template instantiation");
else if (is_friend && cxx11_attribute_p (attributes))
{
+ auto_diagnostic_group d;
if (warning (OPT_Wattributes, "attribute ignored"))
inform (input_location, "an attribute that appertains to a friend "
"declaration that is not a definition is ignored");
}
else
{
+ auto_diagnostic_group d;
error_at (type_start_token->location,
"multiple definition of %q#T", type);
inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)),
case RID_VOLATILE:
if (volatile_loc)
{
+ auto_diagnostic_group d;
error_at (loc, "duplicate %<asm%> qualifier %qT",
token->u.value);
inform (volatile_loc, "first seen here");
case RID_INLINE:
if (inline_loc)
{
+ auto_diagnostic_group d;
error_at (loc, "duplicate %<asm%> qualifier %qT",
token->u.value);
inform (inline_loc, "first seen here");
case RID_GOTO:
if (goto_loc)
{
+ auto_diagnostic_group d;
error_at (loc, "duplicate %<asm%> qualifier %qT",
token->u.value);
inform (goto_loc, "first seen here");
attributes -- but ignores them. Made a permerror in GCC 8. */
if (cp_parser_allow_gnu_extensions_p (parser)
&& initialization_kind == CPP_OPEN_PAREN
- && cp_parser_attributes_opt (parser)
- && permerror (input_location,
- "attributes after parenthesized initializer ignored"))
+ && cp_parser_attributes_opt (parser))
{
static bool hint;
- if (flag_permissive && !hint)
+ auto_diagnostic_group d;
+ if (permerror (input_location,
+ "attributes after parenthesized initializer ignored")
+ && flag_permissive && !hint)
{
hint = true;
inform (input_location,
else if (qualifying_scope
&& CLASSTYPE_USE_TEMPLATE (name_type))
{
+ auto_diagnostic_group d;
error_at (declarator_id_start_token->location,
"invalid use of constructor as a template");
inform (declarator_id_start_token->location,
if (type != error_mark_node
&& (COMPLETE_TYPE_P (type) || TYPE_BEING_DEFINED (type)))
{
+ auto_diagnostic_group d;
error_at (type_start_token->location, "redefinition of %q#T",
type);
inform (location_of (type), "previous definition of %q#T",
&& cxx11_attribute_p (decl_specifiers.attributes))
{
decl_specifiers.attributes = NULL_TREE;
+ auto_diagnostic_group d;
if (warning_at (decl_spec_token_start->location,
OPT_Wattributes, "attribute ignored"))
inform (decl_spec_token_start->location, "an attribute "
cp_parser_error, so we incorporate its actions directly. */
if (!cp_parser_simulate_error (parser))
{
+ auto_diagnostic_group d;
error_at (name_location, "reference to %qD is ambiguous",
name);
print_candidates (decl);
A template ... shall not have C linkage. */
if (current_lang_name == lang_name_c)
{
+ auto_diagnostic_group d;
error_at (location, "template with C linkage");
maybe_show_extern_c_location ();
/* Give it C++ linkage to avoid confusing other parts of the
bool seen_as_union = TREE_CODE (type) == UNION_TYPE;
if (seen_as_union != (class_key == union_type))
{
+ auto_diagnostic_group d;
if (permerror (input_location, "%qs tag used in naming %q#T",
class_key == union_type ? "union"
: class_key == record_type ? "struct" : "class",
if (current_namespace
!= decl_namespace_context (tmpl))
{
+ auto_diagnostic_group d;
if (permerror (input_location,
"specialization of %qD in different namespace",
type))
if (templates == NULL_TREE && candidates == NULL_TREE)
{
+ auto_diagnostic_group d;
error ("template-id %qD for %q+D does not match any template "
"declaration", template_id, decl);
if (header_mismatch)
|| (candidates && TREE_CHAIN (candidates))
|| (templates && candidates))
{
+ auto_diagnostic_group d;
error ("ambiguous template specialization %qD for %q+D",
template_id, decl);
candidates = chainon (candidates, templates);
if (parameter_packs)
{
+ auto_diagnostic_group d;
error_at (loc, "parameter packs not expanded with %<...%>:");
while (parameter_packs)
{
if (DECL_SELF_REFERENCE_P (decl))
return false;
+ auto_diagnostic_group d;
if (DECL_TEMPLATE_PARM_P (decl))
error ("declaration of template parameter %q+D shadows "
"template parameter", decl);
int nargs = TREE_VEC_LENGTH (inner_args);
int ntparms;
int i;
- bool did_error_intro = false;
struct template_parm_data tpd;
struct template_parm_data tpd2;
NULL,
/*include_nondeduced_p=*/false);
}
- for (i = 0; i < ntparms; ++i)
- if (tpd.parms[i] == 0)
- {
- /* One of the template parms was not used in a deduced context in the
- specialization. */
- if (!did_error_intro)
- {
- error ("template parameters not deducible in "
- "partial specialization:");
- did_error_intro = true;
- }
- inform (input_location, " %qD",
- TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));
- }
+ {
+ auto_diagnostic_group d;
+ bool did_error_intro = false;
+ for (i = 0; i < ntparms; ++i)
+ if (tpd.parms[i] == 0)
+ {
+ /* One of the template parms was not used in a deduced context in the
+ specialization. */
+ if (!did_error_intro)
+ {
+ error ("template parameters not deducible in "
+ "partial specialization:");
+ did_error_intro = true;
+ }
- if (did_error_intro)
- return error_mark_node;
+ inform (input_location, " %qD",
+ TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));
+ }
+
+ if (did_error_intro)
+ return error_mark_node;
+ }
/* [temp.class.spec]
&& (!flag_concepts
|| !strictly_subsumes (current_template_constraints (), maintmpl)))
{
+ auto_diagnostic_group d;
if (!flag_concepts)
error ("partial specialization %q+D does not specialize "
"any template arguments; to define the primary template, "
parameters. */
if (nargs < DECL_NTPARMS (maintmpl))
{
+ auto_diagnostic_group d;
error ("partial specialization is not more specialized than the "
"primary template because it replaces multiple parameters "
"with a pack expansion");
else if (nargs > DECL_NTPARMS (maintmpl))
{
+ auto_diagnostic_group d;
error ("too many arguments for partial specialization %qT", type);
inform (DECL_SOURCE_LOCATION (maintmpl), "primary template here");
/* Avoid crash below. */
(TI_ARGS (tinfo),
TI_ARGS (get_template_info (DECL_TEMPLATE_RESULT (tmpl)))))
{
+ auto_diagnostic_group d;
error ("template arguments to %qD do not match original "
"template %qD", decl, DECL_TEMPLATE_RESULT (tmpl));
if (!uses_template_parms (TI_ARGS (tinfo)))
if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms))
{
+ auto_diagnostic_group d;
error_n (input_location, TREE_VEC_LENGTH (parms),
"redeclared with %d template parameter",
"redeclared with %d template parameters",
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
location_t loc = cp_expr_loc_or_input_loc (expr);
error_at (loc, "%qE is not a valid template argument for type %qT",
expr, type);
return true;
if (complain & tf_error)
{
+ auto_diagnostic_group d;
location_t loc = cp_expr_loc_or_input_loc (orig_expr);
error_at (loc, "%qE is not a valid template argument for type %qT",
orig_expr, type);
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("%qE is not a valid template argument for type %qT "
"because it is a pointer", expr, type);
inform (input_location, "try using %qE instead",
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("type/value mismatch at argument %d in template "
"parameter list for %qD",
i + 1, in_decl);
{
if (in_decl && (complain & tf_error))
{
+ auto_diagnostic_group d;
error ("type/value mismatch at argument %d in template "
"parameter list for %qD",
i + 1, in_decl);
{
if (in_decl && (complain & tf_error))
{
+ auto_diagnostic_group d;
error ("type/value mismatch at argument %d in "
"template parameter list for %qD",
i + 1, in_decl);
{
if (in_decl && (complain & tf_error))
{
+ auto_diagnostic_group d;
error ("constraint mismatch at argument %d in "
"template parameter list for %qD",
i + 1, in_decl);
bad_nargs:
if (complain & tf_error)
{
+ auto_diagnostic_group d;
if (variadic_p || default_p)
{
nparms -= variadic_p + default_p;
if (PACK_EXPANSION_P (arg)
&& !template_parameter_pack_p (parm))
{
+ auto_diagnostic_group d;
if (DECL_ALIAS_TEMPLATE_P (in_decl))
error_at (location_of (arg),
"pack expansion argument for non-pack parameter "
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("dependent-name %qE is parsed as a non-type, but "
"instantiation yields a type", qualified_id);
inform (input_location, "say %<typename %E%> if a type is meant", qualified_id);
if (unq != function)
{
+ auto_diagnostic_group d;
char const *const msg
= G_("%qD was not declared in this scope, "
"and no declarations were found by "
char *spaces = NULL;
if (!(complain & tf_error))
return error_mark_node;
+ auto_diagnostic_group d;
if (TYPE_P (target))
error ("ambiguous template instantiation for %q#T", target);
else
{
/* Be permissive with equivalent alias templates. */
tree u = get_underlying_template (tmpl);
+ auto_diagnostic_group d;
diagnostic_t dk = (u == tmpl) ? DK_ERROR : DK_PEDWARN;
bool complained
= emit_diagnostic (dk, input_location, 0,
{
if (complain & tf_warning_or_error)
{
+ auto_diagnostic_group d;
error ("class template argument deduction failed:");
perform_dguide_overload_resolution (cands, args, complain);
if (elided)
if (complain & tf_warning_or_error)
{
// TODO: Pass down location from cp_finish_decl.
+ auto_diagnostic_group d;
error ("class template argument deduction for %qT failed: "
"explicit deduction guide selected in "
"copy-list-initialization", type);
guides, this deduction might not be what the user intended. */
if (fndecl != error_mark_node && !any_dguides_p && (complain & tf_warning))
{
+ auto_diagnostic_group d;
if ((!DECL_IN_SYSTEM_HEADER (fndecl)
|| global_dc->m_warn_system_headers)
&& warning (OPT_Wctad_maybe_unsupported,
{
if (complain & tf_warning_or_error)
{
+ auto_diagnostic_group d;
if (permerror (loc, "direct-list-initialization of "
"%<auto%> requires exactly one element"))
inform (loc,
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("request for member %qD is ambiguous", name);
print_candidates (lfi.ambiguous);
}
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
error ("invalid use of member %qD in static member function", decl);
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error ("%qD is not captured", decl);
tree closure = LAMBDA_EXPR_CLOSURE (lambda_expr);
if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr) == CPLD_NONE)
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error (VAR_P (decl)
? G_("use of local variable with automatic storage from "
"containing function")
if (TREE_CODE (decl) == TREE_LIST)
{
/* Ambiguous reference to base members. */
+ auto_diagnostic_group d;
error ("request for member %qD is ambiguous in "
"multiple inheritance lattice", id_expression);
print_candidates (decl);
if (DECL_P (expr))
{
+ auto_diagnostic_group d;
error ("cannot apply %<offsetof%> to member function %qD", expr);
inform (DECL_SOURCE_LOCATION (expr), "declared here");
}
return ret;
if (!ambiguous.is_empty ())
{
+ auto_diagnostic_group d;
const char *str = _("candidates are:");
unsigned int idx;
tree udr;
&& !type_dependent_expression_p (t)
&& !omp_mappable_type (TREE_TYPE (t)))
{
+ auto_diagnostic_group d;
error_at (OMP_CLAUSE_LOCATION (c),
"array section does not have mappable type "
"in %qs clause",
? TREE_TYPE (TREE_TYPE (t))
: TREE_TYPE (t)))
{
+ auto_diagnostic_group d;
error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t,
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
}
else if (!omp_mappable_type (TREE_TYPE (t)))
{
+ auto_diagnostic_group d;
error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t,
cname);
if (new_ && TREE_CODE (TREE_VALUE (new_)) == TREE_LIST)
new_ = TREE_VALUE (new_);
bool err = false;
+ auto_diagnostic_group d;
for (const_tree t = new_; t; t = TREE_CHAIN (t))
{
tree str = TREE_VALUE (t);
{
if (!ISALPHA (c) && c != '_')
{
+ auto_diagnostic_group d;
error ("arguments to the %qE attribute must contain valid "
"identifiers", name);
inform (input_location, "%<%c%> is not a valid first "
{
if (!ISALNUM (c) && c != '_')
{
+ auto_diagnostic_group d;
error ("arguments to the %qE attribute must contain valid "
"identifiers", name);
inform (input_location, "%<%c%> is not a valid character "
{
if (DECL_P (expr))
{
+ auto_diagnostic_group d;
error_at (loc, "invalid use of non-static member function %qD",
expr);
inform (DECL_SOURCE_LOCATION (expr), "declared here");
{
/* The guessed name isn't directly accessible, and no accessor
member function could be found. */
+ auto_diagnostic_group d;
error_at (&rich_loc,
"%q#T has no member named %qE;"
" did you mean %q#D? (not accessible from this context)",
else
{
/* Look up the member. */
- access_failure_info afi;
- if (processing_template_decl)
- /* Even though this class member access expression is at this
- point not dependent, the member itself may be dependent, and
- we must not potentially push a access check for a dependent
- member onto TI_DEFERRED_ACCESS_CHECKS. So don't check access
- ahead of time here; we're going to redo this member lookup at
- instantiation time anyway. */
- push_deferring_access_checks (dk_no_check);
- member = lookup_member (access_path, name, /*protect=*/1,
- /*want_type=*/false, complain,
- &afi);
- if (processing_template_decl)
- pop_deferring_access_checks ();
- afi.maybe_suggest_accessor (TYPE_READONLY (object_type));
+ {
+ auto_diagnostic_group d;
+ access_failure_info afi;
+ if (processing_template_decl)
+ /* Even though this class member access expression is at this
+ point not dependent, the member itself may be dependent, and
+ we must not potentially push a access check for a dependent
+ member onto TI_DEFERRED_ACCESS_CHECKS. So don't check access
+ ahead of time here; we're going to redo this member lookup at
+ instantiation time anyway. */
+ push_deferring_access_checks (dk_no_check);
+ member = lookup_member (access_path, name, /*protect=*/1,
+ /*want_type=*/false, complain,
+ &afi);
+ if (processing_template_decl)
+ pop_deferring_access_checks ();
+ afi.maybe_suggest_accessor (TYPE_READONLY (object_type));
+ }
if (member == NULL_TREE)
{
if (dependentish_scope_p (object_type))
{
if (fndecl)
{
+ auto_diagnostic_group d;
if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE)
{
if (DECL_NAME (fndecl) == NULL_TREE
STRIP_NOPS (cop);
}
+ auto_diagnostic_group d;
bool warned = false;
if (TREE_CODE (cop) == ADDR_EXPR)
{
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error_at (location, "comparing vectors with different "
"element types");
inform (location, "operand types are %qT and %qT",
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error_at (location, "comparing vectors with different "
"number of elements");
inform (location, "operand types are %qT and %qT",
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error_at (loc, "invalid use of %qE to form a "
"pointer-to-member-function", xarg.get_value ());
if (TREE_CODE (xarg) != OFFSET_REF)
{
/* Warn if the expression has boolean value. */
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE
- && (complain & tf_warning)
- && warning_at (location, OPT_Wbool_operation,
- "%<~%> on an expression of type %<bool%>"))
- inform (location, "did you mean to use logical not (%<!%>)?");
+ && (complain & tf_warning))
+ {
+ auto_diagnostic_group d;
+ if (warning_at (location, OPT_Wbool_operation,
+ "%<~%> on an expression of type %<bool%>"))
+ inform (location, "did you mean to use logical not (%<!%>)?");
+ }
arg = cp_perform_integral_promotions (arg, complain);
}
else if (!noconvert && VECTOR_TYPE_P (TREE_TYPE (arg)))
if (complain & tf_error)
{
+ auto_diagnostic_group d;
error_at (loc, "invalid %<static_cast%> from type %qT to type %qT",
TREE_TYPE (expr), type);
if ((TYPE_PTR_P (type) || TYPE_REF_P (type))
rhs = decay_conversion (rhs, complain);
if (rhs == error_mark_node)
return error_mark_node;
- rhs = stabilize_expr (rhs, &init);
- newrhs = cp_build_binary_op (loc, modifycode, lhs, rhs, complain);
- if (newrhs == error_mark_node)
- {
- if (complain & tf_error)
- inform (loc, " in evaluation of %<%Q(%#T, %#T)%>",
- modifycode, TREE_TYPE (lhs), TREE_TYPE (rhs));
- return error_mark_node;
- }
+
+ {
+ auto_diagnostic_group d;
+ rhs = stabilize_expr (rhs, &init);
+ newrhs = cp_build_binary_op (loc, modifycode, lhs, rhs, complain);
+ if (newrhs == error_mark_node)
+ {
+ if (complain & tf_error)
+ inform (loc, " in evaluation of %<%Q(%#T, %#T)%>",
+ modifycode, TREE_TYPE (lhs), TREE_TYPE (rhs));
+ return error_mark_node;
+ }
+ }
if (init)
newrhs = build2 (COMPOUND_EXPR, TREE_TYPE (newrhs), init, newrhs);
bool allow_inverse_p,
bool c_cast_p, tsubst_flags_t complain)
{
+ auto_diagnostic_group d;
tree result;
if (same_type_ignoring_top_level_qualifiers_p (from, to))
{
if (complain & tf_error)
{
+ auto_diagnostic_group d;
+
/* If the right-hand side has unknown type, then it is an
overloaded function. Call instantiate_type to get error
messages. */
(rhs_loc,
has_loc ? &label : NULL,
has_loc ? highlight_colors::percent_h : NULL);
- auto_diagnostic_group d;
switch (errtype)
{
if (!retval && !is_auto (pattern))
{
/* Give a helpful error message. */
+ auto_diagnostic_group d;
error ("return-statement with no value, in function returning %qT",
pattern);
inform (input_location, "only plain %<auto%> return type can be "
if (TREE_CODE (type) == ERROR_MARK)
return false;
+ auto_diagnostic_group d;
if (value)
{
STRIP_ANY_LOCATION_WRAPPER (value);