Comments
Patch
commit 1a54ca9d63f7e6453b3327a5699a39696f856a79
Author: Jason Merrill <jason@redhat.com>
Date: Mon Aug 15 06:15:17 2011 -0400
PR c++/50054
* typeck2.c (cxx_incomplete_type_diagnostic): Handle
init_list_type_node.
@@ -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;
new file mode 100644
@@ -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" }
+}