* decl.c (reshape_init_r): Check complain for missing braces warning.
From-SVN: r238684
+2016-07-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/71350
+ * decl.c (reshape_init_r): Check complain for missing braces warning.
+
2016-07-22 Jason Merrill <jason@redhat.com>
PR c++/71576
}
}
- warning (OPT_Wmissing_braces, "missing braces around initializer for %qT",
- type);
+ if (complain & tf_warning)
+ warning (OPT_Wmissing_braces,
+ "missing braces around initializer for %qT",
+ type);
}
/* Dispatch to specialized routines. */
--- /dev/null
+// PR c++/71350
+// { dg-do compile { target c++11 } }
+
+template<typename T, unsigned int N>
+struct Array
+{
+ T data[N];
+};
+
+template<typename T>
+struct Foo
+{
+ int operator[](const Array<int, 2>& i) const { return 0; }
+ auto bar() -> decltype((*this)[{1,2}] * 0) {
+ return *this; // { dg-error "cannot convert" }
+ }
+};
+
+template struct Foo<int>;