summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/pt.cc7
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/using-enum-10.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/using-enum-10a.C19
3 files changed, 36 insertions, 6 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 31691618d1b..bc8ea06ceae 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -17066,13 +17066,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
17066 17066
17067 if (DECL_TEMPLATE_PARM_P (t)) 17067 if (DECL_TEMPLATE_PARM_P (t))
17068 return tsubst_copy (DECL_INITIAL (t), args, complain, in_decl); 17068 return tsubst_copy (DECL_INITIAL (t), args, complain, in_decl);
17069 /* There is no need to substitute into namespace-scope 17069 if (!uses_template_parms (DECL_CONTEXT (t)))
17070 enumerators. */
17071 if (DECL_NAMESPACE_SCOPE_P (t))
17072 return t; 17070 return t;
17073 /* If ARGS is NULL, then T is known to be non-dependent. */
17074 if (args == NULL_TREE)
17075 return scalar_constant_value (t);
17076 17071
17077 /* Unfortunately, we cannot just call lookup_name here. 17072 /* Unfortunately, we cannot just call lookup_name here.
17078 Consider: 17073 Consider:
diff --git a/gcc/testsuite/g++.dg/cpp2a/using-enum-10.C b/gcc/testsuite/g++.dg/cpp2a/using-enum-10.C
new file mode 100644
index 00000000000..98fe0644729
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/using-enum-10.C
@@ -0,0 +1,16 @@
1// PR c++/103081
2// { dg-do compile { target c++20 } }
3
4enum class Pig { OINK };
5
6struct Hog {
7 using enum Pig;
8 Hog(Pig) { }
9};
10
11template<int>
12void pen() {
13 Hog(Hog::OINK);
14}
15
16template void pen<0>();
diff --git a/gcc/testsuite/g++.dg/cpp2a/using-enum-10a.C b/gcc/testsuite/g++.dg/cpp2a/using-enum-10a.C
new file mode 100644
index 00000000000..daa3221b77a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/using-enum-10a.C
@@ -0,0 +1,19 @@
1// A version of using-enum-10.C where Hog is a template.
2// PR c++/103081
3// { dg-do compile { target c++20 } }
4
5enum class Pig { OINK };
6
7template<int>
8struct Hog {
9 using enum Pig;
10 Hog(Pig) { OINK; }
11};
12
13template<int N>
14void pen() {
15 Hog<1>(Hog<1>::OINK);
16 Hog<N>(Hog<N>::OINK);
17}
18
19template void pen<0>();