aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2018-03-01 22:08:02 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2018-03-01 22:08:02 +0000
commit303f4850651051e7c7ae04851d993246f6110fb6 (patch)
treef9d0aa6cc04b211372ee1f64d265b4033d030cd5
parent56fc943329299ed3b53ddefd9bcdec997ee9cc71 (diff)
downloadgcc-303f4850651051e7c7ae04851d993246f6110fb6.zip
gcc-303f4850651051e7c7ae04851d993246f6110fb6.tar.gz
gcc-303f4850651051e7c7ae04851d993246f6110fb6.tar.bz2
[PR c++/84434] ICE with deduction guide
https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00063.html PR c++/84434 * name-lookup.c (member_vec_dedup): Remove manually peeled iteration. Ignore dependent ctor inheritance. PR c++/84434 * g++.dg/template/pr84434.C: New. From-SVN: r258114
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c84
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/pr84434.C23
4 files changed, 72 insertions, 46 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index df5f48c..4cb5310 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-01 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/84434
+ * name-lookup.c (member_vec_dedup): Remove manually peeled
+ iteration. Ignore dependent ctor inheritance.
+
2018-03-01 Jason Merrill <jason@redhat.com>
PR c++/71569 - decltype of template.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 20db0f4..2773cf4 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1591,68 +1591,58 @@ member_vec_dedup (vec<tree, va_gc> *member_vec)
if (!len)
return;
- tree current = (*member_vec)[0], name = OVL_NAME (current);
- tree next = NULL_TREE, next_name = NULL_TREE;
- for (unsigned jx, ix = 0; ix < len;
- ix = jx, current = next, name = next_name)
+ tree name = OVL_NAME ((*member_vec)[0]);
+ for (unsigned jx, ix = 0; ix < len; ix = jx)
{
+ tree current = NULL_TREE;
tree to_type = NULL_TREE;
tree to_using = NULL_TREE;
tree marker = NULL_TREE;
- if (IDENTIFIER_CONV_OP_P (name))
- {
- marker = current;
- current = OVL_CHAIN (current);
- name = DECL_NAME (OVL_FUNCTION (marker));
- gcc_checking_assert (name == conv_op_identifier);
- }
- if (TREE_CODE (current) == USING_DECL)
+ for (jx = ix; jx < len; jx++)
{
- current = strip_using_decl (current);
- if (is_overloaded_fn (current))
- current = NULL_TREE;
- else if (TREE_CODE (current) == USING_DECL)
+ tree next = (*member_vec)[jx];
+ if (jx != ix)
{
- to_using = current;
- current = NULL_TREE;
+ tree next_name = OVL_NAME (next);
+ if (next_name != name)
+ {
+ name = next_name;
+ break;
+ }
}
- }
- if (current && DECL_DECLARES_TYPE_P (current))
- {
- to_type = current;
- current = NULL_TREE;
- }
-
- for (jx = ix + 1; jx < len; jx++)
- {
- next = (*member_vec)[jx];
- next_name = OVL_NAME (next);
- if (next_name != name)
- break;
-
- if (marker)
+ if (IDENTIFIER_CONV_OP_P (name))
{
- gcc_checking_assert (OVL_FUNCTION (marker)
- == OVL_FUNCTION (next));
+ marker = next;
next = OVL_CHAIN (next);
}
if (TREE_CODE (next) == USING_DECL)
{
+ if (IDENTIFIER_CTOR_P (name))
+ /* Dependent inherited ctor. */
+ continue;
+
next = strip_using_decl (next);
- if (is_overloaded_fn (next))
- next = NULL_TREE;
- else if (TREE_CODE (next) == USING_DECL)
+ if (TREE_CODE (next) == USING_DECL)
{
to_using = next;
- next = NULL_TREE;
+ continue;
}
+
+ if (is_overloaded_fn (next))
+ continue;
}
- if (next && DECL_DECLARES_TYPE_P (next))
- to_type = next;
+ if (DECL_DECLARES_TYPE_P (next))
+ {
+ to_type = next;
+ continue;
+ }
+
+ if (!current)
+ current = next;
}
if (to_using)
@@ -1671,13 +1661,15 @@ member_vec_dedup (vec<tree, va_gc> *member_vec)
current = stat_hack (current, to_type);
}
- gcc_assert (current);
- if (marker)
+ if (current)
{
- OVL_CHAIN (marker) = current;
- current = marker;
+ if (marker)
+ {
+ OVL_CHAIN (marker) = current;
+ current = marker;
+ }
+ (*member_vec)[store++] = current;
}
- (*member_vec)[store++] = current;
}
while (store++ < len)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 38bd3ae..90b53ae 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-01 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/84434
+ * g++.dg/template/pr84434.C: New.
+
2018-03-01 Thomas Preud'homme <thomas.preudhomme@arm.com
* gcc.target/arm/copysign_softfloat_1.c: Remove dg-add-options and add
diff --git a/gcc/testsuite/g++.dg/template/pr84434.C b/gcc/testsuite/g++.dg/template/pr84434.C
new file mode 100644
index 0000000..b005c95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pr84434.C
@@ -0,0 +1,23 @@
+// PR c++/84434 ICE with deduction guide and dependent using decl
+// { dg-do compile { target c++17 } }
+
+template <typename T> class B {
+public:
+ template <typename U> B (U) {}
+};
+
+template <typename T>
+struct scope_guard : B<T> {
+ using base_type = B<T>;
+
+ using base_type::base_type;
+
+ ~scope_guard() = default;
+};
+
+template <typename T>
+scope_guard (T) -> scope_guard<T>;
+
+void Frob () {
+ scope_guard (1);
+}