aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-11-26 15:58:47 -0500
committerJason Merrill <jason@gcc.gnu.org>2009-11-26 15:58:47 -0500
commitc5c39ab37a0a4280456eb82b36dcf4e6a42ad7e8 (patch)
tree700f633b04e9c7e161a382dc9478cdc64d1f701f
parent1e1779fe22dd4609ae3d69c8cf764e773c4a2237 (diff)
downloadgcc-c5c39ab37a0a4280456eb82b36dcf4e6a42ad7e8.zip
gcc-c5c39ab37a0a4280456eb82b36dcf4e6a42ad7e8.tar.gz
gcc-c5c39ab37a0a4280456eb82b36dcf4e6a42ad7e8.tar.bz2
PR c++/42026, DR 239
PR c++/42026, DR 239 * parser.c (cp_parser_postfix_expression): A local extern also prevents arg-dependent lookup. From-SVN: r154686
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c13
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/lookup/koenig8.C14
4 files changed, 29 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4f0d5b8..a4142a2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/42026, DR 239
+ * parser.c (cp_parser_postfix_expression): A local extern also
+ prevents arg-dependent lookup.
+
2009-11-26 Gabriel Dos Reis <gdr@cs.tamu.edu>
* decl.c (grokdeclarator): Remove period at end of diagnosic message.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0b6fa01..cd0382e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4844,14 +4844,13 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
&& is_overloaded_fn (postfix_expression))
{
tree fn = get_first_fn (postfix_expression);
+ fn = STRIP_TEMPLATE (fn);
- if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
- fn = OVL_CURRENT (TREE_OPERAND (fn, 0));
-
- /* Only do argument dependent lookup if regular
- lookup does not find a set of member functions.
- [basic.lookup.koenig]/2a */
- if (!DECL_FUNCTION_MEMBER_P (fn))
+ /* Do not do argument dependent lookup if regular
+ lookup finds a member function or a block-scope
+ function declaration. [basic.lookup.argdep]/3 */
+ if (!DECL_FUNCTION_MEMBER_P (fn)
+ && !DECL_LOCAL_FUNCTION_P (fn))
{
koenig_p = true;
if (!any_type_dependent_arguments_p (args))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ca2cd0e..8d1dbc8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2009-11-26 Jason Merrill <jason@redhat.com>
+ PR c++/42026, DR 239
+ * g++.dg/lookup/koenig8.C: New.
+
PR c++/10690
* g++.dg/template/explicit-args2.C: Add typeid cases.
diff --git a/gcc/testsuite/g++.dg/lookup/koenig8.C b/gcc/testsuite/g++.dg/lookup/koenig8.C
new file mode 100644
index 0000000..b555855
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/koenig8.C
@@ -0,0 +1,14 @@
+// PR c++/42026, DR 239
+// The local extern declaration prevents arg-dependent lookup.
+// { dg-do link }
+
+namespace NS {
+ class T { };
+ void g(T, int);
+}
+NS::T parm;
+void g(NS::T, float) { }
+int main() {
+ extern void g(NS::T, float);
+ g(parm, 1);
+}