[Bug c++/69111] New: Problem with expansion of a parameter pack of templates
realloc at outlook dot de
gcc-bugzilla@gcc.gnu.org
Fri Jan 1 10:20:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69111
Bug ID: 69111
Summary: Problem with expansion of a parameter pack of
templates
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: realloc at outlook dot de
Target Milestone: ---
Created attachment 37203
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37203&action=edit
full example
it seems a pattern for parameter pack expansion is not recognized, if the
pattern is an alias template inside a template class, which takes the parameter
pack as an argument.
version: g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
os: Ubuntu 15.10
system: Kernel 4.3.0-040300rc6-generic x86_64 GNU/Linux
results of compilation attempt:
-----------------------------------------------------------------
g++ -std=c++14 -o test testcase.cpp
testcase.cpp:18:56: error: parameter packs not expanded with ‘...’:
using type = template_list<B<Types>::template type...>;
^
testcase.cpp:18:56: note: ‘Types’
-----------------------------------------------------------------
clang 3.6.2-1 compiles successfully:
-----------------------------------------------------------------
clang++ -std=c++14 -o test testcase.cpp
-----------------------------------------------------------------
full compilation example:
-----------------------------------------------------------------
g++ -v -save-temps -std=c++14 -o test testcase.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.2.1-22ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++14' '-o' 'test'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE testcase.cpp -mtune=generic -march=x86-64
-std=c++14 -fpch-preprocess -fstack-protector-strong -Wformat -Wformat-security
-o testcase.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/5
/usr/include/x86_64-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++14' '-o' 'test'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -fpreprocessed testcase.ii -quiet
-dumpbase testcase.cpp -mtune=generic -march=x86-64 -auxbase testcase
-std=c++14 -version -fstack-protector-strong -Wformat -Wformat-security -o
testcase.s
GNU C++14 (Ubuntu 5.2.1-22ubuntu2) version 5.2.1 20151010 (x86_64-linux-gnu)
compiled by GNU C version 5.2.1 20151010, GMP version 6.0.0, MPFR
version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++14 (Ubuntu 5.2.1-22ubuntu2) version 5.2.1 20151010 (x86_64-linux-gnu)
compiled by GNU C version 5.2.1 20151010, GMP version 6.0.0, MPFR
version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 5ed623d6fe11f4bcc1afee70f77e33b0
testcase.cpp:18:56: error: parameter packs not expanded with ‘...’:
using type = template_list<B<Types>::template type...>;
^
testcase.cpp:18:56: note: ‘Types’
-----------------------------------------------------------------
contents of testcase.ii:
-----------------------------------------------------------------
# 1 "testcase.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "testcase.cpp"
template <template <typename> class ...>
struct template_list {};
template <typename T>
struct A
{};
template <typename>
struct B
{
template <typename T>
using type = A<T>;
};
template <typename ... Types>
struct C
{
using type = template_list<B<Types>::template type...>;
};
int main()
{
return 0;
}
-----------------------------------------------------------------
I also tried g++ version 5.3 in a docker container with the same result:
sudo docker run --rm -v "$PWD":/usr/src/testcase -w /usr/src/testcase
gcc:latest g++ -std=c++14 testcase.cpp
this is my first bug report, so please be tolerant ;-)
More information about the Gcc-bugs
mailing list