[C++ Patch] PR 57947
Paolo Carlini
paolo.carlini@oracle.com
Tue Jul 30 14:48:00 GMT 2013
Hi,
On 07/30/2013 03:30 PM, Jason Merrill wrote:
> How about just returning false from is_std_init_list in C++98 mode?
Sure. It works great.
Thanks,
Paolo.
////////////////////
-------------- next part --------------
/cp
2013-07-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57947
* call.c (is_std_init_list): Return false if cxx_dialect == cxx98.
/testsuite
2013-07-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57947
* g++.dg/parse/crash63.C: New.
-------------- next part --------------
Index: cp/call.c
===================================================================
--- cp/call.c (revision 201331)
+++ cp/call.c (working copy)
@@ -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
Index: testsuite/g++.dg/parse/crash63.C
===================================================================
--- testsuite/g++.dg/parse/crash63.C (revision 0)
+++ testsuite/g++.dg/parse/crash63.C (working copy)
@@ -0,0 +1,10 @@
+// PR c++/57947
+// { dg-options "-std=c++98" }
+
+namespace std
+{
+ template <class E> class initializer_list {};
+ template <int N> struct D { D(initializer_list<int>) {} };
+ D<0> d {1, 2, 3}; // { dg-error "constructor|no matching" }
+ // { dg-warning "initializer list" "" { target *-*-* } 8 }
+}
More information about the Gcc-patches
mailing list