From bd459a6121641c159e7830e7e3905842e1e5a20a Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 30 Jul 2013 16:48:52 +0000 Subject: [PATCH] re PR c++/57947 (internal compiler error: Segmentation fault using extended initializer lists without -std=c++11 or -std=gnu++11) /cp 2013-07-30 Paolo Carlini PR c++/57947 * call.c (is_std_init_list): Return false if cxx_dialect == cxx98. /testsuite 2013-07-30 Paolo Carlini PR c++/57947 * g++.dg/parse/crash63.C: New. From-SVN: r201344 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/crash63.C | 10 ++++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/parse/crash63.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 72acda1..b0c9dcd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-07-30 Paolo Carlini + + PR c++/57947 + * call.c (is_std_init_list): Return false if cxx_dialect == cxx98. + 2013-07-29 Jason Merrill PR c++/57901 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 0574a9c..5634606 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9396,6 +9396,8 @@ is_std_init_list (tree type) /* Look through typedefs. */ if (!TYPE_P (type)) return false; + if (cxx_dialect == cxx98) + return false; type = TYPE_MAIN_VARIANT (type); return (CLASS_TYPE_P (type) && CP_TYPE_CONTEXT (type) == std_node diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 734d78a..dd8f7ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-30 Paolo Carlini + + PR c++/57947 + * g++.dg/parse/crash63.C: New. + 2013-07-30 Tobias Burnus PR fortran/57530 diff --git a/gcc/testsuite/g++.dg/parse/crash63.C b/gcc/testsuite/g++.dg/parse/crash63.C new file mode 100644 index 0000000..c7189c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash63.C @@ -0,0 +1,10 @@ +// PR c++/57947 +// { dg-options "-std=c++98" } + +namespace std +{ + template class initializer_list {}; + template struct D { D(initializer_list) {} }; + D<0> d {1, 2, 3}; // { dg-error "constructor|no matching" } + // { dg-warning "initializer list" "" { target *-*-* } 8 } +} -- 2.7.4