https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117523
Bug ID: 117523
Summary: ICE in dependent_alias_template_spec_p when call a
alias template
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jonathan.poelen at gmail dot com
Target Milestone: ---
This code should compile with a too many arguments error or something because
variadic parameter passed to an alias that doesn't require one, but for now it
gives an ICE.
It compiled (I think wrongly) in a previous version (13.2):
https://godbolt.org/z/ere5cYK6e
$ g++ test.cpp -freport-bug
// Target: x86_64-pc-linux-gnu
// Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
// Thread model: posix
// Supported LTO compression algorithms: zlib zstd
// gcc version 14.2.1 20240910 (GCC)
//
// test.cpp: In instantiation of ‘struct algo<foo>’:
// test.cpp:15:10: required from here
// 15 | algo<foo>::f<void, void>();
// | ^~
// test.cpp:6:9: internal compiler error: in dependent_alias_template_spec_p,
at cp/pt.cc:6737
// 6 | using f = typename Pred::template f<x, y, xs...>;
// | ^
// 0x21a922a internal_error(char const*, ...)
// ???:0
// 0x704ec1 fancy_abort(char const*, int, char const*)
// ???:0
// 0x8e4730 lookup_template_class(tree_node*, tree_node*, tree_node*,
tree_node*, int, int)
// ???:0
// 0x8d90f7 tsubst(tree_node*, tree_node*, int, tree_node*)
// ???:0
// 0x8e1abd instantiate_class_template(tree_node*)
// ???:0
// 0x93ab0b complete_type(tree_node*)
// ???:0
// 0x9cd270 c_common_parse_file()
// ???:0
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues>
for instructions.
// /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/cc1plus -quiet -D_GNU_SOURCE
test.cpp -quiet -dumpdir a- -dumpbase test.cpp -dumpbase-ext .cpp
-mtune=generic -march=x86-64 -freport-bug -o - -frandom-seed=0 -fdump-noaddr
# 0 "test.cpp"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "test.cpp"
template<class Pred>
struct algo
{
template<class x, class y, class... xs>
using f = typename Pred::template f<x, y, xs...>;
};
struct foo
{
template<class x, class y>
using f = int;
};
algo<foo>::f<void, void>();