+2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/88986
+ * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
+ context (the first argument).
+ * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
+ as context.
+
2019-02-12 Jason Merrill <jason@redhat.com>
PR c++/89144 - link error with constexpr initializer_list.
gcc_assert (identifier_p (name));
gcc_assert (TYPE_P (context));
- if (!MAYBE_CLASS_TYPE_P (context))
+ if (TREE_CODE (context) == TYPE_PACK_EXPANSION)
+ /* This can happen for C++17 variadic using (c++/88986). */;
+ else if (!MAYBE_CLASS_TYPE_P (context))
{
if (complain & tf_error)
error ("%q#T is not a class", context);
case TYPENAME_TYPE:
{
- tree ctx = tsubst_aggr_type (TYPE_CONTEXT (t), args, complain,
- in_decl, /*entering_scope=*/1);
+ tree ctx = TYPE_CONTEXT (t);
+ if (TREE_CODE (ctx) == TYPE_PACK_EXPANSION)
+ {
+ ctx = tsubst_pack_expansion (ctx, args, complain, in_decl);
+ if (ctx == error_mark_node
+ || TREE_VEC_LENGTH (ctx) > 1)
+ return error_mark_node;
+ if (TREE_VEC_LENGTH (ctx) == 0)
+ {
+ if (complain & tf_error)
+ error ("%qD is instantiated for an empty pack",
+ TYPENAME_TYPE_FULLNAME (t));
+ return error_mark_node;
+ }
+ ctx = TREE_VEC_ELT (ctx, 0);
+ }
+ else
+ ctx = tsubst_aggr_type (ctx, args, complain, in_decl,
+ /*entering_scope=*/1);
if (ctx == error_mark_node)
return error_mark_node;
+2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/88986
+ * g++.dg/cpp1z/using4.C: New.
+ * g++.dg/cpp1z/using5.C: Likewise.
+ * g++.dg/cpp1z/using6.C: Likewise.
+
2019-02-13 Jakub Jelinek <jakub@redhat.com>
PR target/89290
--- /dev/null
+// PR c++/88986
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct B { typedef int type; };
+
+template<typename ...T> struct C : T... {
+ using typename T::type ...; // { dg-warning "pack expansion" "" { target c++14_down } }
+ void f() { type value; }
+};
+
+template struct C<B>;
--- /dev/null
+// PR c++/88986
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template<typename ...T> struct C : T... {
+ using typename T::type ...; // { dg-warning "pack expansion" "" { target c++14_down } }
+ void f() { type value; } // { dg-error "empty pack" }
+};
+
+template struct C<>;
--- /dev/null
+// PR c++/88986
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct B1 { typedef int type; };
+struct B2 { typedef double type; };
+
+template<typename ...T> struct C : T... {
+ using typename T::type ...; // { dg-warning "pack expansion" "" { target c++14_down } }
+ // { dg-error "redeclaration" "" { target *-*-* } .-1 }
+ void f() { type value; }
+};
+
+template struct C<B1, B2>;