From 5bdbfdb315e5958a4a4269affddb679189539770 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 5 Jun 2018 11:27:12 +0000 Subject: [PATCH] PR c++/85731 - wrong error with qualified-id in template. * semantics.c (finish_qualified_id_expr): build_qualified_name for unbound names in the current class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261196 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 2 ++ gcc/testsuite/g++.dg/template/qualified-id7.C | 15 +++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/qualified-id7.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c07371ee3a6..f4fa21a7a97 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-06-05 Jason Merrill + + PR c++/85731 - wrong error with qualified-id in template. + * semantics.c (finish_qualified_id_expr): build_qualified_name + for unbound names in the current class. + 2018-06-04 Jason Merrill PR c++/61806 - missed SFINAE with partial specialization. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e00331a3ea4..a3426623385 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2098,6 +2098,8 @@ finish_qualified_id_expr (tree qualifying_class, non-type template argument handling. */ if (processing_template_decl && (!currently_open_class (qualifying_class) + || TREE_CODE (expr) == IDENTIFIER_NODE + || TREE_CODE (expr) == TEMPLATE_ID_EXPR || TREE_CODE (expr) == BIT_NOT_EXPR)) expr = build_qualified_name (TREE_TYPE (expr), qualifying_class, expr, diff --git a/gcc/testsuite/g++.dg/template/qualified-id7.C b/gcc/testsuite/g++.dg/template/qualified-id7.C new file mode 100644 index 00000000000..fd952f6fbcf --- /dev/null +++ b/gcc/testsuite/g++.dg/template/qualified-id7.C @@ -0,0 +1,15 @@ +// PR c++/85731 +// { dg-do compile { target c++11 } } + + template + struct Outer { + struct Inner; + template static void f(); + }; + + template + struct Outer::Inner { + decltype(Outer::f<42>()) f(); + }; + + int main() { Outer::Inner().f(); } -- 2.11.4.GIT