[PR86648] use auto identifier for class placeholder templates

Programming / Compilers / GCC - aoliva [138bc75d-0d04-0410-961f-82ee72b054a4] - 17 January 2019 07:32 EST

dwarf2out recognizes unspecified auto types by the identifier. C++ template class placeholders are unspecified auto types that take the identifier of the class rather than those used by preexisting auto types, so dwarf2out ICEs when it finds one of those. Alas, they may be visible to dwarf2out, since the types of e.g. static data members of templates are only deduced at member instantiation, i.e., if the data member is actually referenced, but the data member is added as a field, still with unspecified auto placeholder type, when the enclosing class is instantiated.

I've changed placeholder creator to use an auto identifier instead, which allowed dropping the placeholder test in C++'s is_auto (alas, it can't be used in dwarf2out, think LTO). To avoid losing information in error messages and dumps and whatnot, I've added code to recognize placeholders for template classes say A and print them out as A<...auto...>.

for gcc/cp/ChangeLog

PR c++/86648
- pt.c (make_template_placeholder): Use auto_identifier. (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
- error.c (dump_type): Handle template placeholders.
- cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.

for gcc/testsuite/ChangeLog

PR c++/86648
- gcc.dg/cpp1z/pr86648.C: New.

f97941b78da [PR86648] use auto identifier for class placeholder templates
gcc/cp/ChangeLog | 6 ++++++
gcc/cp/cxx-pretty-print.c | 8 +++++++-
gcc/cp/error.c | 6 ++++++
gcc/cp/pt.c | 5 ++---
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/g++.dg/cpp1z/pr86648.C | 5 +++++
6 files changed, 31 insertions(+), 4 deletions(-)

Upstream: gcc.gnu.org

  • Share