* parser.c (cp_parser_postfix_expression): Do not perform Koenig
lookup if ordinary name-lookup finds a non-function.
* pt.c (tsubst_copy_and_build): Likewise.
PR c++/14361
* parser.c (cp_parser_late_parsing_default_args): Check that there
are no extra tokens after the end of the default-argument
expression.
PR c++/14360
* g++.old-deja/g++.ns/koenig5.C: Remove some error markers.
PR c++/14361
* g++.dg/parse/defarg7.C: New test.
PR c++/14359
* g++.dg/template/friend26.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78739
138bc75d-0d04-0410-961f-
82ee72b054a4
2004-03-01 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14360
+ * parser.c (cp_parser_postfix_expression): Do not perform Koenig
+ lookup if ordinary name-lookup finds a non-function.
+ * pt.c (tsubst_copy_and_build): Likewise.
+
+ PR c++/14361
+ * parser.c (cp_parser_late_parsing_default_args): Check that there
+ are no extra tokens after the end of the default-argument
+ expression.
+
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
PR c++/14324
* lex.c (retrofit_lang_decl): Treat entities with no linkage as
having C++ linkage for name-mangling purposes.
koenig_p = false;
if (idk == CP_ID_KIND_UNQUALIFIED)
{
+ /* We do not perform argument-dependent lookup if
+ normal lookup finds a non-function, in accordance
+ with the expected resolution of DR 218. */
if (args
&& (is_overloaded_fn (postfix_expression)
- || DECL_P (postfix_expression)
|| TREE_CODE (postfix_expression) == IDENTIFIER_NODE))
{
koenig_p = true;
if (DECL_CLASS_SCOPE_P (fn))
pop_nested_class ();
+ /* If the token stream has not been completely used up, then
+ there was extra junk after the end of the default
+ argument. */
+ if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
+ cp_parser_error (parser, "expected `,'");
+
/* Restore saved state. */
parser->lexer = saved_lexer;
parser->local_variables_forbidden_p = saved_local_variables_forbidden_p;
}
call_args = RECUR (TREE_OPERAND (t, 1));
-
+
+ /* We do not perform argument-dependent lookup if normal
+ lookup finds a non-function, in accordance with the
+ expected resolution of DR 218. */
if (koenig_p
&& (is_overloaded_fn (function)
- || DECL_P (function)
|| TREE_CODE (function) == IDENTIFIER_NODE))
function = perform_koenig_lookup (function, call_args);
2004-03-01 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14360
+ * g++.old-deja/g++.ns/koenig5.C: Remove some error markers.
+
+ PR c++/14361
+ * g++.dg/parse/defarg7.C: New test.
+
+ PR c++/14359
+ * g++.dg/template/friend26.C: New test.
+
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
PR c++/14324
* g++.dg/abi/mangle21.C: New test.
--- /dev/null
+// PR c++/14361
+
+class A {
+ A ( int n=0 int n ); // { dg-error "" }
+};
--- /dev/null
+// PR c++/14359
+
+template<typename> struct A {};
+
+template<typename> struct B
+{
+ template<typename T> friend void foo(const A<T>& a, const B&) { a; }
+};
+
+void bar()
+{
+ A<void> a;
+ B<void> b;
+ foo(a,b);
+}
// { dg-do assemble }
// To find function pointers in Koenig lookup is ok as long as we only find one.
namespace A{
- void foo(); // { dg-error "" }
+ void foo();
struct X{};
void (*bar)(X*)=0;
}
using A::X;
-void (*foo)(X*)=0; // { dg-error "" }
+void (*foo)(X*)=0;
void g()
{
- foo(new X); // { dg-error "" } both objects and functions found
+ foo(new X); // ok -- DR 218 says that we find the global
+ // foo variable first, and therefore do not
+ // perform argument-dependent lookup.
bar(new X); // ok
}