summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-02 17:02:38 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-02 17:02:38 +0000
commitce734c959c94df01ca1da332ec4e266dfca8cfc6 (patch)
treea4bc703b59430cc1c6271ad1407d17d48be44c0d /gcc/testsuite/g++.dg
parent6b8740d8d87ebbb17e88bd55cccee5d6ca047061 (diff)
downloadgcc-ce734c959c94df01ca1da332ec4e266dfca8cfc6.tar.gz
PR c++/40308
PR c++/40311 * typeck.c (cp_build_modify_expr): Always pass init-lists to the conversion code. * call.c (implicit_conversion): Allow init-list conversion to scalar during direct-initialization, too. Mark the conversion bad if it has too many levels of braces. (convert_like_real): And give a helpful error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148089 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist13.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist18.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist19.C8
3 files changed, 31 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist13.C b/gcc/testsuite/g++.dg/cpp0x/initlist13.C
index 98af92bca53..9ed6c74419f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist13.C
@@ -2,4 +2,7 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-__complex__ int i ({0}); // { dg-error "cannot convert" }
+#include <complex>
+
+__complex__ int i ({0});
+std::complex<int> i2 ({0});
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist18.C b/gcc/testsuite/g++.dg/cpp0x/initlist18.C
new file mode 100644
index 00000000000..c9a9bcd9415
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist18.C
@@ -0,0 +1,19 @@
+// PR c++/40308, 40311
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+template< typename T >
+struct test {
+ test() : data{} {}
+
+ T data;
+};
+
+int main()
+{
+ test<int> x;
+ test<int*> y;
+ int * a = new int{};
+ int * b = new int{5};
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist19.C b/gcc/testsuite/g++.dg/cpp0x/initlist19.C
new file mode 100644
index 00000000000..418cddc618a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist19.C
@@ -0,0 +1,8 @@
+// { dg-options "-std=c++0x" }
+
+void f(double);
+int main()
+{
+ f({{1}}); // { dg-error "too many braces" }
+ // { dg-error "" "" { target *-*-* } 6 } allow other errors, too
+}