This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] A non-type template parm with a placeholder type is type-dependent.
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 7 May 2019 16:41:49 -0400
- Subject: [C++ PATCH] A non-type template parm with a placeholder type is type-dependent.
I don't remember which PR I was looking at when I stashed this change away for
GCC 10; it ended up not being necessary, but definitely seems correct.
Tested x86_64-pc-linux-gnu, applying to trunk.
* pt.c (type_dependent_expression_p): A non-type template parm with
a placeholder type is type-dependent.
---
gcc/cp/pt.c | 7 +++++++
gcc/cp/ChangeLog | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2f2066e297c..92b67106d63 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25981,6 +25981,13 @@ type_dependent_expression_p (tree expression)
return false;
}
+ /* The type of a non-type template parm declared with a placeholder type
+ depends on the corresponding template argument, even though
+ placeholders are not normally considered dependent. */
+ if (TREE_CODE (expression) == TEMPLATE_PARM_INDEX
+ && is_auto (TREE_TYPE (expression)))
+ return true;
+
gcc_assert (TREE_CODE (expression) != TYPE_DECL);
/* Dependent type attributes might not have made it from the decl to
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e974951dc52..bd0914b8ffa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-07 Jason Merrill <jason@redhat.com>
+
+ * pt.c (type_dependent_expression_p): A non-type template parm with
+ a placeholder type is type-dependent.
+
2019-05-06 Marek Polacek <polacek@redhat.com>
PR c++/90265 - ICE with generic lambda.
base-commit: 1f51079362f27895c9c4e125549f6cc1b4d50568
--
2.20.1