https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71834

            Bug ID: 71834
           Summary: accepts invalid C++11 code with too few number of
                    template arguments for class template
           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: ---

The code is derived from PR 71833. 

$ 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 20160710 (experimental) [trunk revision 238196] (GCC) 
$ 
$ clang++-3.8 -c -std=c++11 small.cpp
small.cpp:7:12: error: too few template arguments for class template 'B'
A < int >::B < 0 > e;  
           ^
small.cpp:3:42: note: template is declared here
  template < Ts ..., typename U > struct B {};
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~        ^
1 error generated.
$ 
$ g++-trunk -c -std=c++11 small.cpp
$ 


----------------------------------------------------


template < typename ... Ts > struct A 
{
  template < Ts ..., typename U > struct B {};
};

// should be, e.g.: A < int >::B < 0, int > e; 
A < int >::B < 0 > e;

Reply via email to