summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-06-22 14:57:21 -0400
committerJason Merrill <jason@redhat.com>2022-06-22 23:46:32 -0400
commit4fcf79c8ab835615aea0687195871ac43b84d156 (patch)
treeea24b4cc76f8ca2500e44e17f66fd03ff8945f0b
parentaarch64: Revert bogus fix for PR105254 (diff)
downloadgcc-4fcf79c8ab835615aea0687195871ac43b84d156.tar.gz
gcc-4fcf79c8ab835615aea0687195871ac43b84d156.tar.bz2
gcc-4fcf79c8ab835615aea0687195871ac43b84d156.tar.xz
c++: class scope function lookup [PR105908]
In r12-1273 for PR91706, I removed the code in get_class_binding that stripped BASELINK. This testcase demonstrates that we still need to strip it in outer_binding before putting the overload set in IDENTIFIER_BINDING, for compatibility with bindings added directly for declarations. PR c++/105908 gcc/cp/ChangeLog: * name-lookup.cc (outer_binding): Strip BASELINK. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/trailing16.C: New test.
-rw-r--r--gcc/cp/name-lookup.cc4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/trailing16.C17
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
index 7b0638d3166..56256babda8 100644
--- a/gcc/cp/name-lookup.cc
+++ b/gcc/cp/name-lookup.cc
@@ -7626,6 +7626,10 @@ outer_binding (tree name,
7626 /* Thread this new class-scope binding onto the 7626 /* Thread this new class-scope binding onto the
7627 IDENTIFIER_BINDING list so that future lookups 7627 IDENTIFIER_BINDING list so that future lookups
7628 find it quickly. */ 7628 find it quickly. */
7629 if (BASELINK_P (class_binding->value))
7630 /* Don't put a BASELINK in IDENTIFIER_BINDING. */
7631 class_binding->value
7632 = BASELINK_FUNCTIONS (class_binding->value);
7629 class_binding->previous = outer; 7633 class_binding->previous = outer;
7630 if (binding) 7634 if (binding)
7631 binding->previous = class_binding; 7635 binding->previous = class_binding;
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing16.C b/gcc/testsuite/g++.dg/cpp0x/trailing16.C
new file mode 100644
index 00000000000..4feb3f81c27
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing16.C
@@ -0,0 +1,17 @@
1// PR c++/105908
2// { dg-do compile { target c++11 } }
3
4struct test
5{
6 template <typename T>
7 int templated_func();
8
9 template <typename T>
10 auto call_templated_func() -> decltype(templated_func<T>());
11};
12
13template <typename T>
14auto test::call_templated_func() -> decltype(templated_func<T>())
15{
16 return templated_func<T>();
17}