+2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/77752
+ * name-lookup.c (pushtag_1): Add check for bogus, non template,
+ std::initializer_list.
+
2017-03-21 Jakub Jelinek <jakub@redhat.com>
PR c++/35878
decl = pushdecl_with_scope_1 (decl, b, /*is_friend=*/false);
if (decl == error_mark_node)
return decl;
+
+ if (DECL_CONTEXT (decl) == std_node
+ && strcmp (TYPE_NAME_STRING (type), "initializer_list") == 0
+ && !CLASSTYPE_TEMPLATE_INFO (type))
+ {
+ error ("declaration of std::initializer_list does not match "
+ "#include <initializer_list>, isn't a template");
+ return error_mark_node;
+ }
}
if (! in_class)
+2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/77752
+ * g++.dg/cpp0x/initlist97.C: New.
+ * g++.dg/cpp0x/initlist85.C: Update.
+
2017-03-21 Jakub Jelinek <jakub@redhat.com>
PR c/67338
namespace std
{
- struct initializer_list {}; // { dg-message "initializer_list" }
+ struct initializer_list {}; // { dg-error "declaration" }
}
void foo(std::initializer_list &);
void f()
{
- foo({1, 2});
+ foo({1, 2}); // { dg-error "invalid initialization" }
}
-
-// { dg-prune-output "compilation terminated" }
--- /dev/null
+// PR c++/77752
+// { dg-do compile { target c++11 } }
+
+namespace std {
+ class initializer_list; // { dg-error "declaration" }
+}
+void f(std::initializer_list l) { f({2}); } // { dg-error "incomplete type" }