https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70254
Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler@googlemail. | |com --- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> --- The following code: //--------------- template<typename Creator> class NamedResourceFactory { using ResourceType = decltype(Creator())::type::pointer; }; int main(){} //--------------- compiled against gcc 4.9.0, 5.1.0, 5.2.0 results in the following output: <quote> prog.cc:4:26: internal compiler error: Segmentation fault using ResourceType = decltype(Creator())::type::pointer; ^ 0x94d21f crash_signal ../../gcc-4.9.0/gcc/toplev.c:337 0x56c94a resolve_typename_type(tree_node*, bool) ../../gcc-4.9.0/gcc/cp/pt.c:21385 0x5b1c01 cp_parser_nested_name_specifier_opt ../../gcc-4.9.0/gcc/cp/parser.c:5188 0x5bcc13 cp_parser_id_expression ../../gcc-4.9.0/gcc/cp/parser.c:4713 0x5bd5ff cp_parser_parse_and_diagnose_invalid_type_name ../../gcc-4.9.0/gcc/cp/parser.c:3024 0x5aa3e7 cp_parser_type_specifier_seq ../../gcc-4.9.0/gcc/cp/parser.c:18139 0x5ba452 cp_parser_type_id_1 ../../gcc-4.9.0/gcc/cp/parser.c:18000 0x5bf069 cp_parser_type_id ../../gcc-4.9.0/gcc/cp/parser.c:18040 0x5bf069 cp_parser_alias_declaration ../../gcc-4.9.0/gcc/cp/parser.c:16135 0x5a43a5 cp_parser_member_declaration ../../gcc-4.9.0/gcc/cp/parser.c:20186 0x5a7f50 cp_parser_member_specification_opt ../../gcc-4.9.0/gcc/cp/parser.c:20093 0x5a7f50 cp_parser_class_specifier_1 ../../gcc-4.9.0/gcc/cp/parser.c:19321 0x5a7f50 cp_parser_class_specifier ../../gcc-4.9.0/gcc/cp/parser.c:19548 0x5a7f50 cp_parser_type_specifier ../../gcc-4.9.0/gcc/cp/parser.c:14337 0x5be620 cp_parser_decl_specifier_seq ../../gcc-4.9.0/gcc/cp/parser.c:11573 0x5c2d63 cp_parser_single_declaration ../../gcc-4.9.0/gcc/cp/parser.c:23159 0x5c3224 cp_parser_template_declaration_after_export ../../gcc-4.9.0/gcc/cp/parser.c:23035 0x5cb639 cp_parser_declaration ../../gcc-4.9.0/gcc/cp/parser.c:10973 0x5ca1a8 cp_parser_declaration_seq_opt ../../gcc-4.9.0/gcc/cp/parser.c:10895 0x5cb9aa cp_parser_translation_unit ../../gcc-4.9.0/gcc/cp/parser.c:4030 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. 1 Finish </quote> The problem seems to be fixed in the current head (Tested: gcc HEAD 6.0.0 20160311 (experimental)), where the normal compiler diagnostics is produced: <quote> prog.cc:4:26: error: need 'typename' before 'typename decltype (Creator())::type::pointer' because 'typename decltype (Creator())::type' is a dependent scope using ResourceType = decltype(Creator())::type::pointer; </quote>