diff options
author | Jason Merrill <jason@redhat.com> | 2018-06-05 07:27:12 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-06-05 07:27:12 -0400 |
commit | 066c4268db267ef6d88498b001b143db404e495e (patch) | |
tree | 02d15ca6201cbea5a62728fe74ecdcfe98705b6f | |
parent | b401e50fed4def25e82ee118ea42e7145a85c56b (diff) | |
download | gcc-066c4268db267ef6d88498b001b143db404e495e.zip gcc-066c4268db267ef6d88498b001b143db404e495e.tar.gz gcc-066c4268db267ef6d88498b001b143db404e495e.tar.bz2 |
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.
From-SVN: r261196
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/qualified-id7.C | 15 |
3 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c07371e..f4fa21a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-06-05 Jason Merrill <jason@redhat.com> + + 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 <jason@redhat.com> PR c++/61806 - missed SFINAE with partial specialization. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e00331a..a342662 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 0000000..fd952f6 --- /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 <typename T> + struct Outer { + struct Inner; + template <int I> static void f(); + }; + + template <typename T> + struct Outer<T>::Inner { + decltype(Outer<T>::f<42>()) f(); + }; + + int main() { Outer<int>::Inner().f(); } |