OSDN Git Service

PR c++/50054
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Aug 2011 23:25:43 +0000 (23:25 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Aug 2011 23:25:43 +0000 (23:25 +0000)
* typeck2.c (cxx_incomplete_type_diagnostic): Handle
init_list_type_node.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177810 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist57.C [new file with mode: 0644]

index a18a24c..ea1a8d0 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50054
+       * typeck2.c (cxx_incomplete_type_diagnostic): Handle
+       init_list_type_node.
+
 2011-08-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/50075
index 0788138..79aa354 100644 (file)
@@ -450,6 +450,12 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
       break;
 
     case LANG_TYPE:
+      if (type == init_list_type_node)
+       {
+         emit_diagnostic (diag_kind, input_location, 0,
+                          "invalid use of brace-enclosed initializer list");
+         break;
+       }
       gcc_assert (type == unknown_type_node);
       if (value && TREE_CODE (value) == COMPONENT_REF)
        goto bad_member;
index 54053b9..2e56e74 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50054
+       * g++.dg/cpp0x/initlist56.C: New.
+
 2011-08-15  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR testsuite/50085
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist57.C b/gcc/testsuite/g++.dg/cpp0x/initlist57.C
new file mode 100644 (file)
index 0000000..d945a46
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/50054
+// { dg-options -std=c++0x }
+
+void g( const int& (a)[1] ) {} // { dg-error "array of references" }
+
+int main () {
+    g( { 1, 2 } );             // { dg-error "initializer list" }
+}