aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-02-24 14:56:03 -0500
committerJason Merrill <jason@gcc.gnu.org>2016-02-24 14:56:03 -0500
commitb8599b68edc1626c905752d56b6c9b99ac89f126 (patch)
tree334d70750d1d5c152ae962c55ff76d92110e3927 /gcc
parent4e7bcf32fe3bb1878fc09d2ba7a478ba19660b86 (diff)
downloadgcc-b8599b68edc1626c905752d56b6c9b99ac89f126.zip
gcc-b8599b68edc1626c905752d56b6c9b99ac89f126.tar.gz
gcc-b8599b68edc1626c905752d56b6c9b99ac89f126.tar.bz2
PR c++/69323 - valid
* pt.c (instantiate_class_template_1): Set processing_template_decl before substituting friend_type. From-SVN: r233681
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/testsuite/g++.dg/template/friend61.C12
3 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 764d2a8..8fe4306 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/69323
+ * pt.c (instantiate_class_template_1): Set
+ processing_template_decl before substituting friend_type.
+
016-02-24 Martin Sebor <msebor@redhat.com>
PR c++/69912
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 65edfa7..e9cdf6e8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10180,11 +10180,11 @@ instantiate_class_template_1 (tree type)
template <class U> friend class T::C;
otherwise. */
+ /* Bump processing_template_decl in case this is something like
+ template <class T> friend struct A<T>::B. */
+ ++processing_template_decl;
friend_type = tsubst (friend_type, args,
tf_warning_or_error, NULL_TREE);
- /* Bump processing_template_decl for correct
- dependent_type_p calculation. */
- ++processing_template_decl;
if (dependent_type_p (friend_type))
adjust_processing_template_decl = true;
--processing_template_decl;
diff --git a/gcc/testsuite/g++.dg/template/friend61.C b/gcc/testsuite/g++.dg/template/friend61.C
new file mode 100644
index 0000000..1604f5c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend61.C
@@ -0,0 +1,12 @@
+// PR c++/69323
+
+template<int VALUE>
+struct Outer
+{
+ struct StupidValueTrick
+ {
+ template<int VAL> friend struct Outer<VAL>::StupidValueTrick;
+ };
+};
+typedef Outer<42>::StupidValueTrick GoodValue;
+GoodValue good;