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

--- Comment #14 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ cat ./tmp0/024.ii
  template<bool, typename>
    struct __enable_if
    { };
  template<typename _Tp>
    struct __enable_if<true, _Tp>
    { typedef _Tp __type; };

$ valgrind /tmp/cc1plus ./tmp0/024.ii
==25053== Memcheck, a memory error detector
==25053== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25053== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==25053== Command: /tmp/cc1plus ./tmp0/024.ii
==25053== 
==25053== Invalid read of size 1
==25053==    at 0x1048C3D0: convert_template_argument(tree_node*, tree_node*,
tree_node*, int, int, tree_node*) (in /tmp/cc1plus)
==25053==    by 0x1048FBCF: coerce_template_parms(tree_node*, tree_node*,
tree_node*, int, bool, bool) (in /tmp/cc1plus)
==25053==    by 0x10498E77: get_partial_spec_bindings(tree_node*, tree_node*,
tree_node*) (in /tmp/cc1plus)
==25053==    by 0x104E9267: process_partial_specialization(tree_node*) (in
/tmp/cc1plus)
==25053==    by 0x104EEA83: maybe_process_partial_specialization(tree_node*)
(in /tmp/cc1plus)
==25053==    by 0x104168C7: cp_parser_class_specifier_1(cp_parser*) (in
/tmp/cc1plus)
==25053==    by 0x104182EB: cp_parser_type_specifier(cp_parser*, int,
cp_decl_specifier_seq*, bool, int*, bool*) (in /tmp/cc1plus)
==25053==    by 0x104196FB: cp_parser_decl_specifier_seq(cp_parser*, int,
cp_decl_specifier_seq*, int*) (in /tmp/cc1plus)
==25053==    by 0x10451097: cp_parser_single_declaration(cp_parser*,
vec<deferred_access_check, va_gc, vl_embed>*, bool, bool, bool*) (in
/tmp/cc1plus)
==25053==    by 0x1045156B:
cp_parser_template_declaration_after_parameters(cp_parser*, tree_node*, bool)
(in /tmp/cc1plus)
==25053==    by 0x1045221B: cp_parser_explicit_template_declaration(cp_parser*,
bool) (in /tmp/cc1plus)
==25053==    by 0x1045655B: cp_parser_declaration(cp_parser*) (in /tmp/cc1plus)
==25053==  Address 0x129f47c5 is not stack'd, malloc'd or (recently) free'd
==25053== 
./tmp0/024.ii: In substitution of ‘template<bool <anonymous>, class> struct
__enable_if [with bool <anonymous> = true; <template-parameter-1-2> = _Tp]’:
./tmp0/024.ii:5:12:   required from here
./tmp0/024.ii:5:12: internal compiler error: Segmentation fault
    5 |     struct __enable_if<true, _Tp>
      |            ^~~~~~~~~~~~~~~~~~~~~~

Reply via email to