Commit b2f6675b by Paolo Carlini Committed by Paolo Carlini

re PR c++/71238 (Undeclared function message imprecisely points to error column)

/cp
2016-05-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71238
	* lex.c (unqualified_name_lookup_error): Take a location too.
	(unqualified_fn_lookup_error): Take a cp_expr.
	* cp-tree.h (unqualified_name_lookup_error,
	unqualified_fn_lookup_error): Adjust declarations.
	* semantics.c (perform_koenig_lookup): Adjust
	unqualified_fn_lookup_error call, pass the location of
	the identifier too as part of a cp_expr.

/testsuite
2016-05-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71238
	* g++.dg/parse/pr71238.C: New.
	* g++.dg/concepts/friend1.C: Test column numbers too.
	* g++.dg/cpp0x/initlist31.C: Likewise.
	* g++.dg/cpp0x/pr51420.C: Likewise.
	* g++.dg/cpp0x/udlit-declare-neg.C: Likewise.
	* g++.dg/cpp0x/udlit-member-neg.C: Likewise.
	* g++.dg/ext/builtin3.C: Likewise.
	* g++.dg/lookup/friend12.C: Likewise.
	* g++.dg/lookup/friend7.C: Likewise.
	* g++.dg/lookup/koenig1.C: Likewise.
	* g++.dg/lookup/koenig5.C: Likewise.
	* g++.dg/lookup/used-before-declaration.C: Likewise.
	* g++.dg/overload/koenig1.C: Likewise.
	* g++.dg/template/crash65.C: Likewise.
	* g++.dg/template/friend57.C: Likewise.
	* g++.dg/warn/Wshadow-5.C: Likewise.
	* g++.dg/warn/Wunused-8.C: Likewise.
	* g++.old-deja/g++.bugs/900211_01.C: Likewise.
	* g++.old-deja/g++.jason/lineno5.C: Likewise.
	* g++.old-deja/g++.jason/member.C: Likewise.
	* g++.old-deja/g++.jason/report.C: Likewise.
	* g++.old-deja/g++.jason/scoping12.C: Likewise.
	* g++.old-deja/g++.law/visibility20.C: Likewise.
	* g++.old-deja/g++.ns/koenig5.C: Likewise.
	* g++.old-deja/g++.other/static5.C: Likewise.
	* g++.old-deja/g++.pt/overload2.C: Likewise.

From-SVN: r236896
parent 9ce542ba
2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71238
* lex.c (unqualified_name_lookup_error): Take a location too.
(unqualified_fn_lookup_error): Take a cp_expr.
* cp-tree.h (unqualified_name_lookup_error,
unqualified_fn_lookup_error): Adjust declarations.
* semantics.c (perform_koenig_lookup): Adjust
unqualified_fn_lookup_error call, pass the location of
the identifier too as part of a cp_expr.
2016-05-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71099 PR c++/71099
* parser.c (cp_parser_function_specifier_opt): Use current_class_type * parser.c (cp_parser_function_specifier_opt): Use current_class_type
to improve the diagnostic about wrong uses of 'virtual'. to improve the diagnostic about wrong uses of 'virtual'.
......
...@@ -5974,8 +5974,9 @@ extern tree build_vtbl_address (tree); ...@@ -5974,8 +5974,9 @@ extern tree build_vtbl_address (tree);
extern void cxx_dup_lang_specific_decl (tree); extern void cxx_dup_lang_specific_decl (tree);
extern void yyungetc (int, int); extern void yyungetc (int, int);
extern tree unqualified_name_lookup_error (tree); extern tree unqualified_name_lookup_error (tree,
extern tree unqualified_fn_lookup_error (tree); location_t = UNKNOWN_LOCATION);
extern tree unqualified_fn_lookup_error (cp_expr);
extern tree build_lang_decl (enum tree_code, tree, tree); extern tree build_lang_decl (enum tree_code, tree, tree);
extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree); extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree);
extern void retrofit_lang_decl (tree); extern void retrofit_lang_decl (tree);
......
...@@ -443,27 +443,29 @@ handle_pragma_java_exceptions (cpp_reader* /*dfile*/) ...@@ -443,27 +443,29 @@ handle_pragma_java_exceptions (cpp_reader* /*dfile*/)
IDENTIFIER_NODE) failed. Returns the ERROR_MARK_NODE. */ IDENTIFIER_NODE) failed. Returns the ERROR_MARK_NODE. */
tree tree
unqualified_name_lookup_error (tree name) unqualified_name_lookup_error (tree name, location_t loc)
{ {
if (loc == UNKNOWN_LOCATION)
loc = EXPR_LOC_OR_LOC (name, input_location);
if (IDENTIFIER_OPNAME_P (name)) if (IDENTIFIER_OPNAME_P (name))
{ {
if (name != ansi_opname (ERROR_MARK)) if (name != ansi_opname (ERROR_MARK))
error ("%qD not defined", name); error_at (loc, "%qD not defined", name);
} }
else else
{ {
if (!objc_diagnose_private_ivar (name)) if (!objc_diagnose_private_ivar (name))
{ {
error ("%qD was not declared in this scope", name); error_at (loc, "%qD was not declared in this scope", name);
suggest_alternatives_for (location_of (name), name); suggest_alternatives_for (loc, name);
} }
/* Prevent repeated error messages by creating a VAR_DECL with /* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */ this NAME in the innermost block scope. */
if (local_bindings_p ()) if (local_bindings_p ())
{ {
tree decl; tree decl;
decl = build_decl (input_location, decl = build_decl (loc, VAR_DECL, name, error_mark_node);
VAR_DECL, name, error_mark_node);
DECL_CONTEXT (decl) = current_function_decl; DECL_CONTEXT (decl) = current_function_decl;
push_local_binding (name, decl, 0); push_local_binding (name, decl, 0);
/* Mark the variable as used so that we do not get warnings /* Mark the variable as used so that we do not get warnings
...@@ -475,13 +477,18 @@ unqualified_name_lookup_error (tree name) ...@@ -475,13 +477,18 @@ unqualified_name_lookup_error (tree name)
return error_mark_node; return error_mark_node;
} }
/* Like unqualified_name_lookup_error, but NAME is an unqualified-id /* Like unqualified_name_lookup_error, but NAME_EXPR is an unqualified-id
used as a function. Returns an appropriate expression for NAME, encapsulated with its location in a CP_EXPR, used as a function.
NAME. */ Returns an appropriate expression for NAME. */
tree tree
unqualified_fn_lookup_error (tree name) unqualified_fn_lookup_error (cp_expr name_expr)
{ {
tree name = name_expr.get_value ();
location_t loc = name_expr.get_location ();
if (loc == UNKNOWN_LOCATION)
loc = input_location;
if (processing_template_decl) if (processing_template_decl)
{ {
/* In a template, it is invalid to write "f()" or "f(3)" if no /* In a template, it is invalid to write "f()" or "f(3)" if no
...@@ -494,7 +501,7 @@ unqualified_fn_lookup_error (tree name) ...@@ -494,7 +501,7 @@ unqualified_fn_lookup_error (tree name)
Note that we have the exact wording of the following message in Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */ be kept in synch. */
permerror (input_location, "there are no arguments to %qD that depend on a template " permerror (loc, "there are no arguments to %qD that depend on a template "
"parameter, so a declaration of %qD must be available", "parameter, so a declaration of %qD must be available",
name, name); name, name);
...@@ -503,7 +510,7 @@ unqualified_fn_lookup_error (tree name) ...@@ -503,7 +510,7 @@ unqualified_fn_lookup_error (tree name)
static bool hint; static bool hint;
if (!hint) if (!hint)
{ {
inform (input_location, "(if you use %<-fpermissive%>, G++ will accept your " inform (loc, "(if you use %<-fpermissive%>, G++ will accept your "
"code, but allowing the use of an undeclared name is " "code, but allowing the use of an undeclared name is "
"deprecated)"); "deprecated)");
hint = true; hint = true;
...@@ -512,7 +519,7 @@ unqualified_fn_lookup_error (tree name) ...@@ -512,7 +519,7 @@ unqualified_fn_lookup_error (tree name)
return name; return name;
} }
return unqualified_name_lookup_error (name); return unqualified_name_lookup_error (name, loc);
} }
/* Wrapper around build_lang_decl_loc(). Should gradually move to /* Wrapper around build_lang_decl_loc(). Should gradually move to
......
...@@ -2210,6 +2210,7 @@ perform_koenig_lookup (cp_expr fn, vec<tree, va_gc> *args, ...@@ -2210,6 +2210,7 @@ perform_koenig_lookup (cp_expr fn, vec<tree, va_gc> *args,
tree functions = NULL_TREE; tree functions = NULL_TREE;
tree tmpl_args = NULL_TREE; tree tmpl_args = NULL_TREE;
bool template_id = false; bool template_id = false;
location_t loc = fn.get_location ();
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
{ {
...@@ -2245,7 +2246,7 @@ perform_koenig_lookup (cp_expr fn, vec<tree, va_gc> *args, ...@@ -2245,7 +2246,7 @@ perform_koenig_lookup (cp_expr fn, vec<tree, va_gc> *args,
{ {
/* The unqualified name could not be resolved. */ /* The unqualified name could not be resolved. */
if (complain) if (complain)
fn = unqualified_fn_lookup_error (identifier); fn = unqualified_fn_lookup_error (cp_expr (identifier, loc));
else else
fn = identifier; fn = identifier;
} }
......
2016-05-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71238
* g++.dg/parse/pr71238.C: New.
* g++.dg/concepts/friend1.C: Test column numbers too.
* g++.dg/cpp0x/initlist31.C: Likewise.
* g++.dg/cpp0x/pr51420.C: Likewise.
* g++.dg/cpp0x/udlit-declare-neg.C: Likewise.
* g++.dg/cpp0x/udlit-member-neg.C: Likewise.
* g++.dg/ext/builtin3.C: Likewise.
* g++.dg/lookup/friend12.C: Likewise.
* g++.dg/lookup/friend7.C: Likewise.
* g++.dg/lookup/koenig1.C: Likewise.
* g++.dg/lookup/koenig5.C: Likewise.
* g++.dg/lookup/used-before-declaration.C: Likewise.
* g++.dg/overload/koenig1.C: Likewise.
* g++.dg/template/crash65.C: Likewise.
* g++.dg/template/friend57.C: Likewise.
* g++.dg/warn/Wshadow-5.C: Likewise.
* g++.dg/warn/Wunused-8.C: Likewise.
* g++.old-deja/g++.bugs/900211_01.C: Likewise.
* g++.old-deja/g++.jason/lineno5.C: Likewise.
* g++.old-deja/g++.jason/member.C: Likewise.
* g++.old-deja/g++.jason/report.C: Likewise.
* g++.old-deja/g++.jason/scoping12.C: Likewise.
* g++.old-deja/g++.law/visibility20.C: Likewise.
* g++.old-deja/g++.ns/koenig5.C: Likewise.
* g++.old-deja/g++.other/static5.C: Likewise.
* g++.old-deja/g++.pt/overload2.C: Likewise.
2016-05-30 Jan Hubicka <hubicka@ucw.cz> 2016-05-30 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/tree-ssa/peel1.c: New testcase. * gcc.dg/tree-ssa/peel1.c: New testcase.
......
...@@ -24,7 +24,7 @@ struct X { } x; ...@@ -24,7 +24,7 @@ struct X { } x;
int main() { int main() {
// f(0); // OK // f(0); // OK
f(nt); // { dg-error "cannot call" } f(nt); // { dg-error "cannot call" }
f(x); // { dg-error "not declared" } f(x); // { dg-error "3:'f' was not declared" }
S<int> si; S<int> si;
si == si; // OK si == si; // OK
......
...@@ -8,6 +8,6 @@ struct string { string(std::initializer_list<char>) { } }; ...@@ -8,6 +8,6 @@ struct string { string(std::initializer_list<char>) { } };
void f() { void f() {
auto y = auto y =
{ {
string(Equation()) // { dg-error "not declared" } string(Equation()) // { dg-error "12:'Equation' was not declared" }
}; // { dg-error "unable to deduce" } }; // { dg-error "unable to deduce" }
} }
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
void void
foo() foo()
{ {
float x = operator"" _F(); // { dg-error "was not declared in this scope" } float x = operator"" _F(); // { dg-error "13:'operator\"\"_F' was not declared in this scope" }
float y = 0_F; // { dg-error "unable to find numeric literal operator" } float y = 0_F; // { dg-error "unable to find numeric literal operator" }
} }
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Check that undeclared literal operator calls and literals give appropriate errors. // Check that undeclared literal operator calls and literals give appropriate errors.
int i = operator"" _Bar('x'); // { dg-error "was not declared in this scope" } int i = operator"" _Bar('x'); // { dg-error "9:'operator\"\"_Bar' was not declared in this scope" }
int j = 'x'_Bar; // { dg-error "unable to find character literal operator|with|argument" } int j = 'x'_Bar; // { dg-error "unable to find character literal operator|with|argument" }
int ii = operator"" _BarCharStr("Howdy, Pardner!"); // { dg-error "was not declared in this scope" } int ii = operator"" _BarCharStr("Howdy, Pardner!"); // { dg-error "10:'operator\"\"_BarCharStr' was not declared in this scope" }
int jj = "Howdy, Pardner!"_BarCharStr; // { dg-error "unable to find string literal operator|Possible missing length argument" } int jj = "Howdy, Pardner!"_BarCharStr; // { dg-error "unable to find string literal operator|Possible missing length argument" }
unsigned long long iULL = operator"" _BarULL(666ULL); // { dg-error "was not declared in this scope" } unsigned long long iULL = operator"" _BarULL(666ULL); // { dg-error "27:'operator\"\"_BarULL' was not declared in this scope" }
unsigned long long jULL = 666_BarULL; // { dg-error "unable to find numeric literal operator" } unsigned long long jULL = 666_BarULL; // { dg-error "unable to find numeric literal operator" }
long double iLD = operator"" _BarLD(666.0L); // { dg-error "was not declared in this scope" } long double iLD = operator"" _BarLD(666.0L); // { dg-error "19:'operator\"\"_BarLD' was not declared in this scope" }
long double jLD = 666.0_BarLD; // { dg-error "unable to find numeric literal operator" } long double jLD = 666.0_BarLD; // { dg-error "unable to find numeric literal operator" }
...@@ -7,7 +7,7 @@ public: ...@@ -7,7 +7,7 @@ public:
int operator"" _Bar(char32_t); // { dg-error "must be a non-member function" } int operator"" _Bar(char32_t); // { dg-error "must be a non-member function" }
}; };
int i = operator"" _Bar(U'x'); // { dg-error "was not declared in this scope" } int i = operator"" _Bar(U'x'); // { dg-error "9:'operator\"\"_Bar' was not declared in this scope" }
int j = U'x'_Bar; // { dg-error "unable to find character literal operator" } int j = U'x'_Bar; // { dg-error "unable to find character literal operator" }
int int
......
...@@ -9,6 +9,6 @@ extern "C" int printf(char*, ...); // { dg-message "std::printf" } ...@@ -9,6 +9,6 @@ extern "C" int printf(char*, ...); // { dg-message "std::printf" }
} }
void foo() { void foo() {
printf("abc"); // { dg-error "not declared" } printf("abc"); // { dg-error "3:'printf' was not declared" }
// { dg-message "suggested alternative" "suggested alternative" { target *-*-* } 12 } // { dg-message "suggested alternative" "suggested alternative" { target *-*-* } 12 }
} }
...@@ -6,5 +6,5 @@ void foo() ...@@ -6,5 +6,5 @@ void foo()
{ {
friend void bar(); // { dg-error "without prior declaration" } friend void bar(); // { dg-error "without prior declaration" }
}; };
bar(); // { dg-error "not declared" } bar(); // { dg-error "3:'bar' was not declared" }
} }
...@@ -11,7 +11,7 @@ int main() ...@@ -11,7 +11,7 @@ int main()
struct S { friend void g(); friend void h(S); }; struct S { friend void g(); friend void h(S); };
struct T { friend void g(); friend void h(T); }; struct T { friend void g(); friend void h(T); };
void i() { void i() {
g(); // { dg-error "not declared" } g(); // { dg-error "3:'g' was not declared" }
S s; S s;
h(s); h(s);
T t; T t;
......
...@@ -9,5 +9,5 @@ class X; ...@@ -9,5 +9,5 @@ class X;
void foo() { void foo() {
X x(1); // { dg-error "incomplete type" "" } X x(1); // { dg-error "incomplete type" "" }
bar(x); // { dg-error "not declared" "" } bar(x); // { dg-error "3:'bar' was not declared" "" }
} }
...@@ -31,12 +31,12 @@ void g (N::A *a, M::B *b, O::C *c) ...@@ -31,12 +31,12 @@ void g (N::A *a, M::B *b, O::C *c)
{ {
One (a); // ok One (a); // ok
One (a, b); // ok One (a, b); // ok
One (b); // { dg-error "not declared" } One (b); // { dg-error "3:'One' was not declared" }
// { dg-message "suggested alternatives" "suggested alternative for One" { target *-*-* } 34 } // { dg-message "suggested alternatives" "suggested alternative for One" { target *-*-* } 34 }
Two (c); // ok Two (c); // ok
Two (a, c); // ok Two (a, c); // ok
Two (a); // { dg-error "not declared" } Two (a); // { dg-error "3:'Two' was not declared" }
// { dg-message "suggested alternatives" "suggested alternative for Two" { target *-*-* } 39 } // { dg-message "suggested alternatives" "suggested alternative for Two" { target *-*-* } 39 }
Two (a, a); // error masked by earlier error Two (a, a); // error masked by earlier error
Two (b); // error masked by earlier error Two (b); // error masked by earlier error
...@@ -44,6 +44,6 @@ void g (N::A *a, M::B *b, O::C *c) ...@@ -44,6 +44,6 @@ void g (N::A *a, M::B *b, O::C *c)
Three (b); // ok Three (b); // ok
Three (a, b); // ok Three (a, b); // ok
Three (a); // { dg-error "not declared" } Three (a); // { dg-error "3:'Three' was not declared" }
// { dg-message "suggested alternatives" "suggested alternative for Three" { target *-*-* } 47 } // { dg-message "suggested alternatives" "suggested alternative for Three" { target *-*-* } 47 }
} }
// Copyroght (C) 2003 Free Software Foundation // Copyroght (C) 2003 Free Software Foundation
// Origin: PR/12832, Jonathan Wakely <redi@gcc.gnu.org> // Origin: PR/12832, Jonathan Wakely <redi@gcc.gnu.org>
void f() { g(); } // { dg-error "not declared" "" } void f() { g(); } // { dg-error "12:'g' was not declared" "" }
void g() { } void g() { }
...@@ -13,7 +13,7 @@ void g () ...@@ -13,7 +13,7 @@ void g ()
{ {
B *bp; B *bp;
N::A *ap; N::A *ap;
f (bp); // { dg-error "not declared" } f (bp); // { dg-error "3:'f' was not declared" }
// { dg-message "suggested alternative" "suggested alternative" { target *-*-* } 16 } // { dg-message "suggested alternative" "suggested alternative" { target *-*-* } 16 }
f (ap); f (ap);
} }
// PR c++/71238
int main()
{
int x=myFunc(3234); // { dg-error "11:'myFunc' was not declared" }
}
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
struct A struct A
{ {
template<int> template<typename T> friend void foo(T) {} // { dg-error "parameter" } template<int> template<typename T> friend void foo(T) {} // { dg-error "parameter" }
void bar() { foo(0); } // { dg-error "foo" } void bar() { foo(0); } // { dg-error "16:'foo' was not declared" }
}; };
...@@ -15,7 +15,7 @@ int ...@@ -15,7 +15,7 @@ int
main () main ()
{ {
f(1); f(1);
g(1); // { dg-error "'g' was not declared in this scope" } g(1); // { dg-error "3:'g' was not declared in this scope" }
g(S()); g(S());
h(1); h(1);
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
int f (int n) int f (int n)
{ {
int bar (int n) { return n++; } // { dg-error "a function-definition is not allowed here" } int bar (int n) { return n++; } // { dg-error "a function-definition is not allowed here" }
return bar (n); // { dg-error "was not declared in this scope" } return bar (n); // { dg-error "12:'bar' was not declared in this scope" }
} }
int g (int i) int g (int i)
......
...@@ -5,5 +5,5 @@ int main () ...@@ -5,5 +5,5 @@ int main ()
{ {
// We should not see an "unused" warning about "whatever" on the // We should not see an "unused" warning about "whatever" on the
// next line. // next line.
return whatever (); // { dg-error "declared" } return whatever (); // { dg-error "10:'whatever' was not declared" }
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
void global_function_0 () void global_function_0 ()
{ {
global_function_1 (); /* { dg-error "" } */ global_function_1 (); /* { dg-error "3:'global_function_1' was not declared" } */
} }
int main () { return 0; } int main () { return 0; }
...@@ -6,5 +6,5 @@ template <class T> class A; ...@@ -6,5 +6,5 @@ template <class T> class A;
int main() int main()
{ {
A<int> *p; A<int> *p;
undef1();// { dg-error "" } undef1();// { dg-error "3:'undef1' was not declared" }
} }
...@@ -5,31 +5,31 @@ struct Y ...@@ -5,31 +5,31 @@ struct Y
struct X struct X
{ {
int A; int A;
int Y::X::* foo () { undef1(1); return &Y::X::A; }// { dg-error "" } foo().* int Y::X::* foo () { undef1(1); return &Y::X::A; }// { dg-error "28:'undef1' was not declared" } foo().*
int bar () { return A; } int bar () { return A; }
}; };
}; };
int Y::X::* foo () int Y::X::* foo ()
{ {
undef2(1);// { dg-error "" } foo().* undef2(1);// { dg-error "3:'undef2' was not declared" } foo().*
return &Y::X::A; return &Y::X::A;
} }
int Y::X::* (* foo2 ())() int Y::X::* (* foo2 ())()
{ {
undef3(1);// { dg-error "" } foo().* undef3(1);// { dg-error "3:'undef3' was not declared" } foo().*
return foo; return foo;
} }
int (Y::X::* bar2 ()) () int (Y::X::* bar2 ()) ()
{ {
undef4(1);// { dg-error "" } foo\(\).* undef4(1);// { dg-error "3:'undef4' was not declared" } foo\(\).*
return Y::X::bar;// { dg-error "" } foo\(\).* return Y::X::bar;// { dg-error "" } foo\(\).*
} }
int Y::X::* (Y::X::* foo3 ())() int Y::X::* (Y::X::* foo3 ())()
{ {
undef5(1);// { dg-error "" } foo().* undef5(1);// { dg-error "3:'undef5' was not declared" } foo().*
return Y::X::foo;// { dg-error "" } foo().* return Y::X::foo;// { dg-error "" } foo().*
} }
...@@ -37,7 +37,7 @@ int foo (int a = (**bar) (s)) ...@@ -37,7 +37,7 @@ int foo (int a = (**bar) (s))
int foo2 (int (*a)(int) = &foo) int foo2 (int (*a)(int) = &foo)
{ {
undef4 (1); // { dg-error "" } implicit declaration undef4 (1); // { dg-error "4:'undef4' was not declared" } implicit declaration
return 1; return 1;
} }
...@@ -55,7 +55,7 @@ bar2 baz (X::Y y) // { dg-error "" } in this context ...@@ -55,7 +55,7 @@ bar2 baz (X::Y y) // { dg-error "" } in this context
X::Y f; // { dg-error "" } in this context X::Y f; // { dg-error "" } in this context
bar2 wa [5]; bar2 wa [5];
wa[0] = baz(f); wa[0] = baz(f);
undef2 (1); // { dg-error "" } implicit declaration undef2 (1); // { dg-error "3:'undef2' was not declared" } implicit declaration
} // { dg-warning "no return statement" } } // { dg-warning "no return statement" }
int ninny () int ninny ()
...@@ -70,5 +70,5 @@ int ninny () ...@@ -70,5 +70,5 @@ int ninny ()
int darg (char X::*p) int darg (char X::*p)
{ {
undef3 (1); // { dg-error "" } implicit declaration undef3 (1); // { dg-error "4:'undef3' was not declared" } implicit declaration
} // { dg-warning "no return statement" } } // { dg-warning "no return statement" }
...@@ -6,5 +6,5 @@ void f () ...@@ -6,5 +6,5 @@ void f ()
}; };
} }
void h () { void h () {
g (); // { dg-error "" } no g in scope g (); // { dg-error "3:'g' was not declared" } no g in scope
} }
...@@ -31,6 +31,6 @@ int main() { ...@@ -31,6 +31,6 @@ int main() {
Base b; Base b;
Derived d; Derived d;
d.noticeThisFunction(&b); d.noticeThisFunction(&b);
printf("gpptest run\n");// { dg-error "" } .* printf("gpptest run\n");// { dg-error "5:'printf' was not declared" } .*
} }
...@@ -14,6 +14,6 @@ void g() ...@@ -14,6 +14,6 @@ void g()
foo(new X); // ok -- DR 218 says that we find the global foo(new X); // ok -- DR 218 says that we find the global
// foo variable first, and therefore do not // foo variable first, and therefore do not
// perform argument-dependent lookup. // perform argument-dependent lookup.
bar(new X); // { dg-error "not declared" } bar(new X); // { dg-error "3:'bar' was not declared" }
// { dg-message "suggested alternative" "suggested alternative" { target *-*-* } 17 } // { dg-message "suggested alternative" "suggested alternative" { target *-*-* } 17 }
} }
...@@ -9,7 +9,7 @@ struct S ...@@ -9,7 +9,7 @@ struct S
inline void f() inline void f()
{ {
static S s; static S s;
atexit (0); // { dg-error "" } implicit declaration atexit (0); // { dg-error "3:'atexit' was not declared" } implicit declaration
} }
......
...@@ -12,5 +12,5 @@ int ...@@ -12,5 +12,5 @@ int
main() main()
{ {
C<char*> c; C<char*> c;
char* p = Z(c.O); //{ dg-error "" } ambiguous c.O char* p = Z(c.O); //{ dg-error "13:'Z' was not declared" } ambiguous c.O
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment