This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/72763] New: incorrectly accepts invalid C++11 code that instantiates a non-template class
- From: "su at cs dot ucdavis.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 01 Aug 2016 06:13:50 +0000
- Subject: [Bug c++/72763] New: incorrectly accepts invalid C++11 code that instantiates a non-template class
- Auto-submitted: auto-generated
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;