summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-06-01 17:58:57 -0400
committerJason Merrill <jason@redhat.com>2020-06-02 15:00:00 -0400
commit4b68cb38ddca37a14a6f2f43de3a6d396ee1bc79 (patch)
treef366c93602724605812cf3de0e5dcc828b92ef7a /gcc/cp
parent4013baf99c38f7bca06a51f8301e8fb195ccfa33 (diff)
c++: *this capture in const member fn [PR95193].
Here, the capture proxy for *this is const, but its DECL_VALUE_EXPR is not. Don't ICE on this; it's a reasonable difference, since in C++ an rvalue of scalar type does not have cv-qualifiers. gcc/cp/ChangeLog: PR c++/95193 * pt.c (tsubst_decl): Relax assert. gcc/testsuite/ChangeLog: PR c++/95193 * g++.dg/cpp1z/lambda-this7.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 907ca879c73..9c03c5a5bbd 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14633,7 +14633,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
&& DECL_BIT_FIELD_TYPE (TREE_OPERAND (ve, 1)) == type)
type = TREE_TYPE (ve);
else
- gcc_checking_assert (TREE_TYPE (ve) == type);
+ gcc_checking_assert (TYPE_MAIN_VARIANT (TREE_TYPE (ve))
+ == TYPE_MAIN_VARIANT (type));
SET_DECL_VALUE_EXPR (r, ve);
}
if (CP_DECL_THREAD_LOCAL_P (r)