aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-04-29 10:58:20 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-04-29 10:58:20 +0200
commit58627576a491184e918c0e1d49966ad316b1ecd8 (patch)
treeab6d4a8e41ed5cb9b58a5c6347b38597242b2509 /gcc
parentf2be060fd3c04b05c22f3c75c1e32f5b1c7a0f43 (diff)
downloadgcc-58627576a491184e918c0e1d49966ad316b1ecd8.zip
gcc-58627576a491184e918c0e1d49966ad316b1ecd8.tar.gz
gcc-58627576a491184e918c0e1d49966ad316b1ecd8.tar.bz2
re PR c++/35650 (Can't bind ref-to-function through using-decl. in namespace)
PR c++/35650 * parser.c (cp_parser_lookup_name): Look through single function OVERLOAD. * g++.dg/init/ref17.C: New test. From-SVN: r134788
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c7
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/init/ref17.C23
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 15aa14c..bb4c4af 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2008-04-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/35650
+ * parser.c (cp_parser_lookup_name): Look through single function
+ OVERLOAD.
+
PR c++/35987
* typeck.c (cp_build_modify_expr) <case PREINCREMENT_EXPR>: Don't build
COMPOUND_EXPR if the second argument would be error_mark_node.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 21a762d..a78e124 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -16447,6 +16447,13 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
decl = lookup_qualified_name (parser->scope, name,
tag_type != none_type,
/*complain=*/true);
+
+ /* If we have a single function from a using decl, pull it out. */
+ if (decl
+ && TREE_CODE (decl) == OVERLOAD
+ && !really_overloaded_fn (decl))
+ decl = OVL_FUNCTION (decl);
+
if (pushed_scope)
pop_scope (pushed_scope);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1154c10..d14a2cc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2008-04-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/35650
+ * g++.dg/init/ref17.C: New test.
+
PR c++/35987
* g++.dg/other/error28.C: New test.
diff --git a/gcc/testsuite/g++.dg/init/ref17.C b/gcc/testsuite/g++.dg/init/ref17.C
new file mode 100644
index 0000000..2c8c22b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/ref17.C
@@ -0,0 +1,23 @@
+// PR c++/35650
+// { dg-do compile }
+
+void f1 ();
+
+namespace N
+{
+ using::f1;
+ void f2 ();
+ void f3 ();
+}
+
+using N::f3;
+
+void
+test ()
+{
+ void (&a) () = f1;
+ void (&b) () = N::f1;
+ void (&c) () = N::f2;
+ void (&d) () = f3;
+ void (&e) () = ::f3;
+}