https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96464
Bug ID: 96464
Summary: GCC allows 'auto' in template argument
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi, all.
This code is invalid code I guess, but GCC-6.0 onwards versions accept it.
$cat small.cc
template <class> class b {};
void foo(){
auto var = [] (class b<auto>...) {};
}
$g++ -c small.cc
//nothing
$clang++ -c small.cc
small.cc:3:28: error: 'auto' not allowed in template argument
auto var = [] (class b<auto>...) {};
^~~~
1 error generated.
Thanks,
Haoxin