Valgrind output:
$ valgrind -q --trace-children=yes g++ testcase.C
testcase.C:3:14: error: explicit specialization in non-namespace scope 'struct
S< <template-parameter-1-1> >'
testcase.C:3:23: error: specialization of 'template<class> struct S' must
appear at namespace scope
testcase.C:3:23: error: template parameters not used in partial specialization:
testcase.C:3:23: error:         '<template-parameter-1-1>'
==28340== Invalid read of size 2
==28340==    at 0x4AF07A: build_new_method_call (call.c:6221)
==28340==    by 0x4B0A70: build_special_member_call (call.c:6126)
==28340==    by 0x5AA481: expand_aggr_init_1 (init.c:1355)
==28340==    by 0x5AF0B8: build_aggr_init (init.c:1275)
==28340==    by 0x4B6673: build_aggr_init_full_exprs (decl.c:5138)
==28340==    by 0x4D3CD1: cp_finish_decl (decl.c:5264)
==28340==    by 0x57C63D: cp_parser_init_declarator (parser.c:13743)
==28340==    by 0x57CFCA: cp_parser_simple_declaration (parser.c:8943)
==28340==    by 0x57D3D6: cp_parser_block_declaration (parser.c:8841)
==28340==    by 0x583EA9: cp_parser_declaration (parser.c:8746)
==28340==    by 0x583919: cp_parser_declaration_seq_opt (parser.c:8637)
==28340==    by 0x584C24: c_parse_file (parser.c:3091)
==28340==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==28340==
testcase.C:9:14: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


------ testcase.C ------
template < typename > struct S
{
  template < > struct S < int >
  {
    S(int);
  };
};

S < int > s(0);
------------------------

Tested revisions:
r158150, 4.5 r158131, 4.4 r158133 - crash
4.4.3, 4.3.4, 4.1.2, 3.4.6, 3.3.6 - crash
4.2.4 - OK (without asserts)

Only 4.2.4 works:
$ g++-4.2.4 testcase.C
testcase.C:3: error: explicit specialization in non-namespace scope 'struct S<
<template-parameter-1-1> >'
testcase.C:9: error: no matching function for call to 'S<int>::S(int)'
testcase.C:2: note: candidates are: S<int>::S()
testcase.C:2: note:                 S<int>::S(const S<int>&)


-- 
           Summary: ICE: SIGSEGV with template specialization in non-
                    namespace space
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43705

Reply via email to