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]

[C++ Patch] PR 51786


Hi,

we got a couple of duplicates of this. The issue is that things like:

struct A {};
void foo() { decltype(A()); }

are turned by finish_decltype_type, called by cp_parser_simple_declaration via cp_parser_decl_specifier_seq, into something like:

struct A {};
void foo() { struct A; }

and later check_tag_decl, called via shadow_tag, doesn't see anything wrong wrt [dcl.dcl]/3, to wit doesn't see a declaration which doesn't declare anything. "Luckily" we have declares_class_or_enum available and we can query it to figure out whether a diagnostic is in fact in order.

Tested x86_64-linux.

Thanks,
Paolo.

PS: in fact we issue a permerror, not an error: I did some tests and I don't think that unconditionally zeroing the type even if we end up only emitting a warning can cause problems. But please double check, thanks!

//////////////////////////////

Attachment: CL_51786
Description: Text document

Attachment: patch_51786
Description: Text document


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