https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Bug ID: 72763 Summary: incorrectly accepts invalid C++11 code that instantiates a non-template class Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- It affects 4.8.x and later, and is correctly rejected by 4.7.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160731 (experimental) [trunk revision 238915] (GCC) $ $ g++-trunk -c -Wall -Wextra -std=c++11 small.cpp $ clang++-3.8 -c -std=c++11 small.cpp small.cpp:3:25: error: 'D' following the 'template' keyword does not refer to a template template < typename T > using C = typename A < T >::template D < T >; ^~~~~ small.cpp:7:14: note: in instantiation of template type alias 'C' requested here struct D : C < T > {}; ^ 1 error generated. $ $ g++-4.7 -c -std=c++11 small.cpp small.cpp:3:69: error: ‘typename A< <template-parameter-1-1> >::D’ names ‘struct A< <template-parameter-1-1> >::D’, which is not a class template $ ----------------------------------------------------------------------- template < typename > struct A; template < typename T > using C = typename A < T >::template D < T >; template < typename T > struct A { struct D : C < T > {}; }; A < int > a; |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid Status|UNCONFIRMED |NEW Last reconfirmed| |2016-08-01 CC| |marxin at gcc dot gnu.org Target Milestone|--- |4.9.4 Ever confirmed|0 |1 --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Confirmed. |
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.9.4 |5.5 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- GCC 4.9 branch is being closed |
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Depends on| |72764 Known to fail| |4.8.5, 4.9.3, 5.3.0, 6.1.0, | |7.0 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- The test case was rejected prior to r191412 (see also bug 72764 for an ICE caused by this commit): r191412 | jason | 2012-09-17 23:47:35 -0400 (Mon, 17 Sep 2012) | 4 lines PR c++/54575 * pt.c (instantiate_alias_template): New. (tsubst): Use it. (push_access_scope): Allow TYPE_DECL. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72764 [Bug 72764] [5/6/7 Regression] ICE on invalid C++11 code instantiating an alias template: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in typedef_variant_p, at tree.c:12660 |
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 |
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |jason at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org |
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |INVALID --- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- This looks well-formed to me; we don't substitute into C<T> until we need D to be complete, which we don't when we're just using A<int>. If you change the declaration of a to A<int>::D a; then you get the error you're expecting. |
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72763
Bug 72763 depends on bug 72764, which changed state. Bug 72764 Summary: [7 Regression] ICE on invalid C++11 code instantiating an alias template: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in typedef_variant_p, at tree.c:12660 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72764 What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED |
Free forum by Nabble | Edit this page |