aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2019-02-13 10:34:49 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2019-02-13 10:34:49 +0000
commiteeebb022b22ec51557bc1c731dc168d58c6e1cd3 (patch)
treec844cf39cd063eef35ab6d93d10efc6d758b5328 /gcc/cp
parent3e7f831c2a312ce3c8b0a60417a896203dcbbf56 (diff)
downloadgcc-eeebb022b22ec51557bc1c731dc168d58c6e1cd3.zip
gcc-eeebb022b22ec51557bc1c731dc168d58c6e1cd3.tar.gz
gcc-eeebb022b22ec51557bc1c731dc168d58c6e1cd3.tar.bz2
re PR c++/88986 (ICE: tree check: expected tree that contains 'decl minimal' structure, have 'error_mark' in member_vec_binary_search, at cp/name-lookup.c:1136)
/cp 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. /testsuite 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. From-SVN: r268839
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/pt.c21
3 files changed, 30 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cb74761..b423f7c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4038197..31d7dc5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3816,7 +3816,9 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
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);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b96e3aa..e6782fe 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14928,8 +14928,25 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
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;