2019-01-08 Marek Polacek <polacek@redhat.com>
+ PR c++/88538 - braced-init-list in template-argument-list.
+ * parser.c (cp_parser_template_argument): Handle braced-init-list when
+ in C++20.
+
PR c++/88548 - this accepted in static member functions.
* parser.c (cp_debug_parser): Adjust printing of
local_variables_forbidden_p.
argument = cp_parser_constant_expression (parser);
else
{
+ /* In C++20, we can encounter a braced-init-list. */
+ if (cxx_dialect >= cxx2a
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ bool expr_non_constant_p;
+ return cp_parser_braced_list (parser, &expr_non_constant_p);
+ }
+
/* With C++17 generalized non-type template arguments we need to handle
lvalue constant expressions, too. */
argument = cp_parser_assignment_expression (parser);
+2019-01-08 Marek Polacek <polacek@redhat.com>
+
+ PR c++/88538 - braced-init-list in template-argument-list.
+ * g++.dg/cpp2a/nontype-class11.C: New test.
+
2019-01-08 Jakub Jelinek <jakub@redhat.com>
PR target/88457
--- /dev/null
+// PR c++/88538
+// { dg-do compile { target c++2a } }
+
+struct S {
+ unsigned a;
+ unsigned b;
+ constexpr S(unsigned _a, unsigned _b) noexcept: a{_a}, b{_b} { }
+};
+
+template <S p>
+void fnc()
+{
+}
+
+template<S s> struct X { };
+
+void f()
+{
+ fnc<{10,20}>();
+ X<{1, 2}> x;
+}