Commit 7797a622 by Paolo Carlini Committed by Paolo Carlini

decl.c (grokdeclarator): Use declarator->id_loc in five error_at calls.

/cp
2019-05-31  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (grokdeclarator): Use declarator->id_loc in five
	error_at calls.

/testsuite
2019-05-31  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/alias-decl-18.C: Test location too.
	* g++.dg/cpp0x/udlit-nofunc-neg.C: Likewise.
	* g++.dg/parse/crash59.C: Likewise.
	* g++.dg/parse/error38.C: Likewise.
	* g++.dg/parse/error39.C: Likewise.
	* g++.dg/template/crash31.C: Likewise.
	* g++.dg/template/operator8.C: Likewise.
	* g++.dg/template/operator9.C: Likewise.

From-SVN: r271762
parent 979ca9cc
2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grokdeclarator): Use declarator->id_loc in five
error_at calls.
2019-05-29 Jakub Jelinek <jakub@redhat.com> 2019-05-29 Jakub Jelinek <jakub@redhat.com>
PR c++/90598 PR c++/90598
......
...@@ -10609,7 +10609,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10609,7 +10609,8 @@ grokdeclarator (const cp_declarator *declarator,
D1 ( parameter-declaration-clause) ... */ D1 ( parameter-declaration-clause) ... */
if (funcdef_flag && innermost_code != cdk_function) if (funcdef_flag && innermost_code != cdk_function)
{ {
error ("function definition does not declare parameters"); error_at (declarator->id_loc,
"function definition does not declare parameters");
return error_mark_node; return error_mark_node;
} }
...@@ -10617,7 +10618,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10617,7 +10618,8 @@ grokdeclarator (const cp_declarator *declarator,
&& innermost_code != cdk_function && innermost_code != cdk_function
&& ! (ctype && !declspecs->any_specifiers_p)) && ! (ctype && !declspecs->any_specifiers_p))
{ {
error ("declaration of %qD as non-function", dname); error_at (declarator->id_loc,
"declaration of %qD as non-function", dname);
return error_mark_node; return error_mark_node;
} }
...@@ -10626,7 +10628,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10626,7 +10628,8 @@ grokdeclarator (const cp_declarator *declarator,
if (UDLIT_OPER_P (dname) if (UDLIT_OPER_P (dname)
&& innermost_code != cdk_function) && innermost_code != cdk_function)
{ {
error ("declaration of %qD as non-function", dname); error_at (declarator->id_loc,
"declaration of %qD as non-function", dname);
return error_mark_node; return error_mark_node;
} }
...@@ -10634,12 +10637,14 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10634,12 +10637,14 @@ grokdeclarator (const cp_declarator *declarator,
{ {
if (typedef_p) if (typedef_p)
{ {
error ("declaration of %qD as %<typedef%>", dname); error_at (declarator->id_loc,
"declaration of %qD as %<typedef%>", dname);
return error_mark_node; return error_mark_node;
} }
else if (decl_context == PARM || decl_context == CATCHPARM) else if (decl_context == PARM || decl_context == CATCHPARM)
{ {
error ("declaration of %qD as parameter", dname); error_at (declarator->id_loc,
"declaration of %qD as parameter", dname);
return error_mark_node; return error_mark_node;
} }
} }
......
2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp0x/alias-decl-18.C: Test location too.
* g++.dg/cpp0x/udlit-nofunc-neg.C: Likewise.
* g++.dg/parse/crash59.C: Likewise.
* g++.dg/parse/error38.C: Likewise.
* g++.dg/parse/error39.C: Likewise.
* g++.dg/template/crash31.C: Likewise.
* g++.dg/template/operator8.C: Likewise.
* g++.dg/template/operator9.C: Likewise.
2019-05-29 Bill Schmidt <wschmidt@linux.ibm.com> 2019-05-29 Bill Schmidt <wschmidt@linux.ibm.com>
* gcc.target/powerpc/notoc-direct-1.c: New. * gcc.target/powerpc/notoc-direct-1.c: New.
......
...@@ -5,5 +5,6 @@ template<typename Z> using ::T = void(int n); // { dg-error "" } ...@@ -5,5 +5,6 @@ template<typename Z> using ::T = void(int n); // { dg-error "" }
template<typename Z> using operator int = void(int n); // { dg-error "" } template<typename Z> using operator int = void(int n); // { dg-error "" }
template<typename Z> using typename U = void; // { dg-error "" } template<typename Z> using typename U = void; // { dg-error "" }
template<typename Z> using typename ::V = void(int n); // { dg-error "" } template<typename Z> using typename ::V = void(int n); // { dg-error "" }
template<typename Z> using typename ::operator bool = void(int n); // { dg-error "" } template<typename Z> using typename ::operator bool = void(int n); // { dg-error "39:declaration" }
// { dg-error "expected" "" { target *-*-* } .-1 }
using foo __attribute__((aligned(4)) = int; // { dg-error "" } using foo __attribute__((aligned(4)) = int; // { dg-error "" }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Test user-defined literals. // Test user-defined literals.
// Test error on non-function declaration. // Test error on non-function declaration.
double operator"" _baddecl; // { dg-error "as non-function" } double operator"" _baddecl; // { dg-error "8:declaration of .operator\"\"_baddecl. as non-function" }
template<char...> template<char...>
int operator"" _badtmpldecl; // { dg-error "as non-function" } int operator"" _badtmpldecl; // { dg-error "7:declaration of .operator\"\"_badtmpldecl. as non-function" }
// PR c++/53003 // PR c++/53003
struct A{ void a{} return b // { dg-error "function definition|expected" } struct A{ void a{} return b // { dg-error "16:function definition" }
// { dg-error "expected" "" { target *-*-* } .-1 }
// PR c++/29003 // PR c++/29003
typedef int operator !(); // { dg-error "declaration" } typedef int operator !(); // { dg-error "13:declaration" }
// PR c++/41769 // PR c++/41769
void f(void operator+()); // { dg-error "declaration" } void f(void operator+()); // { dg-error "13:declaration" }
void g() void g()
{ {
...@@ -8,7 +8,7 @@ void g() ...@@ -8,7 +8,7 @@ void g()
{ {
} }
catch(void operator+()) // { dg-error "declaration" } catch(void operator+()) // { dg-error "14:declaration" }
{ {
} }
} }
// PR c++/19063 // PR c++/19063
template<operator< struct A {}; // { dg-error "" } template<operator< struct A {}; // { dg-error "10:declaration" }
// { dg-error "expected|extra" "" { target *-*-* } .-1 }
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
struct A struct A
{ {
template<operator+> void foo() {} // { dg-error "identifier|parameter|template arguments" } template<operator+> void foo() {} // { dg-error "14:declaration" }
// { dg-error "expected|template" "" { target *-*-* } .-1 }
}; };
//PR c++/27670 //PR c++/27670
template<operator+> void foo(); // { dg-error "before|parameter|template" } template<operator+> void foo(); // { dg-error "10:declaration" }
// { dg-error "expected|template" "" { target *-*-* } .-1 }
void bar() void bar()
{ {
......
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