Fabien Chêne
2014-09-24 21:06:34 UTC
Hi,
The problem here is that the use of an elaborated-type-specifier
(introduced via 'struct') does not find USING_DECLs, whereas it does
for a simple-type-specifier. That's caused by xref_tag (through
lookup_and_check_tag) that does not strip USING_DECLs and thus fails
to return a type when it happens to be the target of the USING_DECL.
Unfortunately, just stripping the USING_DECL in lookup_and_check_tag
does not really work because some diagnotic codes expect the
USING_DECL not to be stripped.
Consequently, I have fixed it by introcucing a new parameter to
xref_tag whose purpose is to know if stripping USING_DECLs is
desirable. Not very exciting to fix it this way, but that is the only
solution I managed to find.
Tested x86_64 linux without regressions. OK to commit to trunk ? And
branches after some weeks of incubation ?
gcc/cp/ChangeLog
2014-09-24 Fabien Chêne <***@gcc.gnu.org>
* cp-tree.h (xref_tag): Add a new bool parameter.
* parser.c (cp_parser_elaborated_type_specifier): Call xref_tag
with strip_using_p set to true.
(cp_parser_class_head): Call xref_tag with strip_using_p set to
false.
* rtti.c (init_rtti_processing): Likewise.
(build_dynamic_cast_1): Likewise.
(tinfo_base_init): Likewise.
(emit_support_tinfos): Likewise.
* lambda.c (begin_lambda_type): Likewise.
(vla_capture_type): Likewise.
* decl.c (lookup_and_check_tag): Add a new bool parameter. Strip
the USING_DECL if strip_using_p is set. Declare the variable t at
the use.
(xref_tag_1): Add a new bool parameter. Forward strip_using_p to
lookup_and_check_tag.
(xref_tag): Add a new bool parameter. Forward strip_using_p to
xref_tag_1.
(xref_tag_from_type): Call xref_tag with strip_using_p set to
false.
(start_enum): Call lookup_and_check_tag with strip_using_p set to
false. Call xref_tag with strip_using_p set to false.
gcc/testsuite/ChangeLog
2014-09-24 Fabien Chêne <***@gcc.gnu.org>
PR c++/56243
* g++.dg/lookup/using56.C: New.
The problem here is that the use of an elaborated-type-specifier
(introduced via 'struct') does not find USING_DECLs, whereas it does
for a simple-type-specifier. That's caused by xref_tag (through
lookup_and_check_tag) that does not strip USING_DECLs and thus fails
to return a type when it happens to be the target of the USING_DECL.
Unfortunately, just stripping the USING_DECL in lookup_and_check_tag
does not really work because some diagnotic codes expect the
USING_DECL not to be stripped.
Consequently, I have fixed it by introcucing a new parameter to
xref_tag whose purpose is to know if stripping USING_DECLs is
desirable. Not very exciting to fix it this way, but that is the only
solution I managed to find.
Tested x86_64 linux without regressions. OK to commit to trunk ? And
branches after some weeks of incubation ?
gcc/cp/ChangeLog
2014-09-24 Fabien Chêne <***@gcc.gnu.org>
* cp-tree.h (xref_tag): Add a new bool parameter.
* parser.c (cp_parser_elaborated_type_specifier): Call xref_tag
with strip_using_p set to true.
(cp_parser_class_head): Call xref_tag with strip_using_p set to
false.
* rtti.c (init_rtti_processing): Likewise.
(build_dynamic_cast_1): Likewise.
(tinfo_base_init): Likewise.
(emit_support_tinfos): Likewise.
* lambda.c (begin_lambda_type): Likewise.
(vla_capture_type): Likewise.
* decl.c (lookup_and_check_tag): Add a new bool parameter. Strip
the USING_DECL if strip_using_p is set. Declare the variable t at
the use.
(xref_tag_1): Add a new bool parameter. Forward strip_using_p to
lookup_and_check_tag.
(xref_tag): Add a new bool parameter. Forward strip_using_p to
xref_tag_1.
(xref_tag_from_type): Call xref_tag with strip_using_p set to
false.
(start_enum): Call lookup_and_check_tag with strip_using_p set to
false. Call xref_tag with strip_using_p set to false.
gcc/testsuite/ChangeLog
2014-09-24 Fabien Chêne <***@gcc.gnu.org>
PR c++/56243
* g++.dg/lookup/using56.C: New.
--
Fabien
Fabien