[Bug c++/83918] New: [c++17, regression from 7.2] ICE on constexpr eval of datatype involving function and variadic template
dimitri.gorokhovik at free dot fr
gcc-bugzilla@gcc.gnu.org
Wed Jan 17 19:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83918
Bug ID: 83918
Summary: [c++17, regression from 7.2] ICE on constexpr eval of
datatype involving function and variadic template
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dimitri.gorokhovik at free dot fr
Target Milestone: ---
Hi,
The following code below compiles with GCC 7.2 (Ubuntu 7.2.0-8ubuntu3) but
provokes the crash (probably segfault) of gcc (GCC) 8.0.1 20180117
(experimental) (r256776).
I honestly tried to look for duplicates in Bugzilla, but it feels like not the
right moment ;-(
========================================================================
constexpr unsigned f (unsigned a, unsigned b) { return a > b ? a : b; }
template <typename a, typename b> struct mult_width;
template <auto ...> struct list;
template <auto a, auto ... as, auto b, auto ... bs>
struct mult_width <list <a, as...>, list <b, bs...>>
{
enum : unsigned
{
h = f (sizeof (a), sizeof (b)),
t = mult_width <list <as...>, list <bs...>>::width,
width = f (h, t)
};
};
template <>
struct mult_width <list <>, list <>>
{
enum : unsigned { width = 0 };
};
constexpr static const auto w { mult_width <list <1,2,3,4,5,6,7,8,9>, list
<9,8,7,6,5,4,3,2,1>>::width };
static_assert (w == sizeof (int));
==========================================================================
Backtrace:
Compilation started at Wed Jan 17 20:20:33
/home/user/gcc-trunk/dist/bin/g++ -std=c++17 -c bug-1.cpp -o bug-1
bug-1.cpp:17:18: internal compiler error: Segmentation fault
width = f (h, t)
^
0xe76e3f crash_signal
../../srcdir/gcc/toplev.c:325
0x82209c potential_constant_expression_1
../../srcdir/gcc/cp/constexpr.c:5386
0x821f8d potential_constant_expression_1
../../srcdir/gcc/cp/constexpr.c:5323
0x8dc487 cp_parser_constant_expression
../../srcdir/gcc/cp/parser.c:9736
0x8f340e cp_parser_enumerator_definition
../../srcdir/gcc/cp/parser.c:18343
0x8f340e cp_parser_enumerator_list
../../srcdir/gcc/cp/parser.c:18283
0x8f340e cp_parser_enum_specifier
../../srcdir/gcc/cp/parser.c:18210
0x8f340e cp_parser_type_specifier
../../srcdir/gcc/cp/parser.c:16670
0x900086 cp_parser_decl_specifier_seq
../../srcdir/gcc/cp/parser.c:13559
0x8efc66 cp_parser_member_declaration
../../srcdir/gcc/cp/parser.c:23443
0x8f0d4a cp_parser_member_specification_opt
../../srcdir/gcc/cp/parser.c:23298
0x8f0d4a cp_parser_class_specifier_1
../../srcdir/gcc/cp/parser.c:22440
0x8f2d89 cp_parser_class_specifier
../../srcdir/gcc/cp/parser.c:22692
0x8f2d89 cp_parser_type_specifier
../../srcdir/gcc/cp/parser.c:16698
0x900086 cp_parser_decl_specifier_seq
../../srcdir/gcc/cp/parser.c:13559
0x904eb5 cp_parser_single_declaration
../../srcdir/gcc/cp/parser.c:27001
0x90523c cp_parser_template_declaration_after_parameters
../../srcdir/gcc/cp/parser.c:26693
0x905afc cp_parser_explicit_template_declaration
../../srcdir/gcc/cp/parser.c:26930
0x905afc cp_parser_template_declaration_after_export
../../srcdir/gcc/cp/parser.c:26949
0x90af09 cp_parser_declaration
../../srcdir/gcc/cp/parser.c:12661
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compilation exited abnormally with code 1 at Wed Jan 17 20:20:33
More information about the Gcc-bugs
mailing list