aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2024-01-17 13:01:01 -0500
committerPatrick Palka <ppalka@redhat.com>2024-01-17 13:01:01 -0500
commit68cea2d32a9fd525154b6a48042e5835d4c5e371 (patch)
tree1b7db769a2c867bc8e4d417e49ad089a423724b6 /gcc/cp
parent6eca0d23b7ea84f1d41057bcc9f71d8e0d2d2fe3 (diff)
downloadgcc-68cea2d32a9fd525154b6a48042e5835d4c5e371.zip
gcc-68cea2d32a9fd525154b6a48042e5835d4c5e371.tar.gz
gcc-68cea2d32a9fd525154b6a48042e5835d4c5e371.tar.bz2
c++: address of class NTTP object as targ [PR113242]
invalid_tparm_referent_p was rejecting using the address of a class NTTP object as a template argument, but this should be fine. PR c++/113242 PR c++/99493 gcc/cp/ChangeLog: * pt.cc (invalid_tparm_referent_p) <case ADDR_EXPR>: Suppress DECL_ARTIFICIAL rejection test for class NTTP objects. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/nontype-class61.C: New test. * g++.dg/cpp2a/nontype-class62.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index b611723..f82d018 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -7217,8 +7217,10 @@ invalid_tparm_referent_p (tree type, tree expr, tsubst_flags_t complain)
* a string literal (5.13.5),
* the result of a typeid expression (8.2.8), or
* a predefined __func__ variable (11.4.1). */
- else if (VAR_P (decl) && DECL_ARTIFICIAL (decl))
+ else if (VAR_P (decl) && DECL_ARTIFICIAL (decl)
+ && !DECL_NTTP_OBJECT_P (decl))
{
+ gcc_checking_assert (DECL_TINFO_P (decl) || DECL_FNAME_P (decl));
if (complain & tf_error)
error ("the address of %qD is not a valid template argument",
decl);