This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR c++/51427 - Better diagnostic when union/struct tags conflict


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

[...]

>> --- a/gcc/cp/parser.c
>> +++ b/gcc/cp/parser.c
>> @@ -22520,10 +22520,14 @@ static void
>> Âcp_parser_check_class_key (enum tag_types class_key, tree type)
>> Â{
>> Â if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
>> - Â Âpermerror (input_location, "%qs tag used in naming %q#T",
>> - Â Â Â Â Â class_key == union_type ? "union"
>> - Â Â Â Â Â Â: class_key == record_type ? "struct" : "class",
>> - Â Â Â Â Â Âtype);
>> + Â Â{
>> + Â Â Âpermerror (input_location, "%qs tag used in naming %q#T",
>> + Â Â Â Â Â Â Â Âclass_key == union_type ? "union"
>> + Â Â Â Â Â Â Â Â: class_key == record_type ? "struct" : "class",
>> + Â Â Â Â Â Â Â Âtype);
>> + Â Â Âinform (DECL_SOURCE_LOCATION (TYPE_NAME (type)),
>> + Â Â Â Â Â Â "%q#T was previously declared here", type);
>> + Â Â}
>> Â}
>
> Hmm, I am wondering if we shouldn't remove the permerror and make it
> an unconditional error.

Just curious, do we have a rule about when to turn permerrors into
unconditional errors and thus stop providing legacy code bases with a
smooth migration path?

-- 
		Dodji


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]