From: Paolo Carlini Date: Thu, 14 Jun 2018 17:49:21 +0000 (+0000) Subject: decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in OPT_Wshadow warning_at. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4d44753398f9b24a622b40c7a1d144a6a6c350c;p=gcc.git decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in OPT_Wshadow warning_at. /cp 2018-06-14 Paolo Carlini * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in OPT_Wshadow warning_at. (grokfndecl): Consistently use the location_t argument in literal operator diagnostic messages. (grokdeclarator): Use declspecs->locations[ds_storage_class] in error_at call. * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION in permerror call. /testsuite 2018-06-14 Paolo Carlini * g++.dg/other/static3.C: New. * g++.dg/other/static4.C: Likewise. * g++.dg/warn/Wshadow-15.C: Likewise. * g++.dg/cpp0x/gnu_fext-numeric-literals.C: Test locations too. * g++.dg/cpp0x/std_fext-numeric-literals.C: Likewise. * g++.dg/cpp0x/std_fno-ext-numeric-literals.C: Likewise. * g++.dg/cpp0x/udlit-args-neg.C: Likewise. * g++.dg/cpp0x/udlit-clink-neg.C: Likewise. * g++.dg/cpp0x/udlit-extern-c.C: Likewise. * g++.dg/cpp0x/udlit-member-neg.C: Likewise. From-SVN: r261601 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 245b6364e2b..d1fdc42aa4b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2018-06-14 Paolo Carlini + + * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in + OPT_Wshadow warning_at. + (grokfndecl): Consistently use the location_t argument in + literal operator diagnostic messages. + (grokdeclarator): Use declspecs->locations[ds_storage_class] + in error_at call. + * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION + in permerror call. + 2018-06-13 Jason Merrill PR c++/86099 - ICE with trivial copy and non-trivial default ctor. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index de1b3415afb..98dea9b766f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1398,10 +1398,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) bad choice of name. */ if (! TREE_PUBLIC (newdecl)) { - warning (OPT_Wshadow, - DECL_BUILT_IN (olddecl) - ? G_("shadowing built-in function %q#D") - : G_("shadowing library function %q#D"), olddecl); + warning_at (DECL_SOURCE_LOCATION (newdecl), + OPT_Wshadow, + DECL_BUILT_IN (olddecl) + ? G_("shadowing built-in function %q#D") + : G_("shadowing library function %q#D"), olddecl); /* Discard the old built-in function. */ return NULL_TREE; } @@ -8863,7 +8864,7 @@ grokfndecl (tree ctype, /* [over.literal]/6: Literal operators shall not have C linkage. */ if (DECL_LANGUAGE (decl) == lang_c) { - error ("literal operator with C linkage"); + error_at (location, "literal operator with C linkage"); maybe_show_extern_c_location (); return NULL_TREE; } @@ -8873,7 +8874,7 @@ grokfndecl (tree ctype, if (!check_literal_operator_args (decl, &long_long_unsigned_p, &long_double_p)) { - error ("%qD has invalid argument list", decl); + error_at (location, "%qD has invalid argument list", decl); return NULL_TREE; } @@ -8881,26 +8882,26 @@ grokfndecl (tree ctype, if (long_long_unsigned_p) { if (cpp_interpret_int_suffix (parse_in, suffix, strlen (suffix))) - warning (0, "integer suffix %qs" + warning_at (location, 0, "integer suffix %qs" " shadowed by implementation", suffix); } else if (long_double_p) { if (cpp_interpret_float_suffix (parse_in, suffix, strlen (suffix))) - warning (0, "floating point suffix %qs" + warning_at (location, 0, "floating point suffix %qs" " shadowed by implementation", suffix); } /* 17.6.3.3.5 */ if (suffix[0] != '_' - && !in_system_header_at (DECL_SOURCE_LOCATION (decl)) + && !in_system_header_at (location) && !current_function_decl && !(friendp && !funcdef_flag)) - warning (OPT_Wliteral_suffix, - "literal operator suffixes not preceded by %<_%>" - " are reserved for future standardization"); + warning_at (location, OPT_Wliteral_suffix, + "literal operator suffixes not preceded by %<_%>" + " are reserved for future standardization"); } else { - error ("%qD must be a non-member function", decl); + error_at (location, "%qD must be a non-member function", decl); return NULL_TREE; } } @@ -12408,7 +12409,8 @@ grokdeclarator (const cp_declarator *declarator, { /* 7.1.1: There can be no static function declarations within a block. */ - error ("cannot declare static function inside another function"); + error_at (declspecs->locations[ds_storage_class], + "cannot declare static function inside another function"); invalid_static = 1; } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index cbe2f2250f2..8917880ba64 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -756,7 +756,8 @@ finish_static_data_member_decl (tree decl, if (LOCAL_CLASS_P (current_class_type) /* We already complained about the template definition. */ && !DECL_TEMPLATE_INSTANTIATION (decl)) - permerror (input_location, "local class %q#T shall not have static data member %q#D", + permerror (DECL_SOURCE_LOCATION (decl), + "local class %q#T shall not have static data member %q#D", current_class_type, decl); else for (tree t = current_class_type; TYPE_P (t); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74e5d850524..ecf65546ec7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2018-06-14 Paolo Carlini + + * g++.dg/other/static3.C: New. + * g++.dg/other/static4.C: Likewise. + * g++.dg/warn/Wshadow-15.C: Likewise. + * g++.dg/cpp0x/gnu_fext-numeric-literals.C: Test locations too. + * g++.dg/cpp0x/std_fext-numeric-literals.C: Likewise. + * g++.dg/cpp0x/std_fno-ext-numeric-literals.C: Likewise. + * g++.dg/cpp0x/udlit-args-neg.C: Likewise. + * g++.dg/cpp0x/udlit-clink-neg.C: Likewise. + * g++.dg/cpp0x/udlit-extern-c.C: Likewise. + * g++.dg/cpp0x/udlit-member-neg.C: Likewise. + 2018-06-14 Jakub Jelinek PR target/85945 diff --git a/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C b/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C index ac2db287f3a..816077d5401 100644 --- a/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C +++ b/gcc/testsuite/g++.dg/cpp0x/gnu_fext-numeric-literals.C @@ -4,73 +4,73 @@ // Integer imaginary... constexpr unsigned long long -operator"" i(unsigned long long n) // { dg-warning "shadowed by implementation" "" { target c++11_only } } +operator"" i(unsigned long long n) // { dg-warning "1:integer suffix .i. shadowed by implementation" "" { target c++11_only } } { return 4 * n + 0; } constexpr unsigned long long -operator"" I(unsigned long long n) // { dg-warning "shadowed by implementation" } +operator"" I(unsigned long long n) // { dg-warning "1:integer suffix .I. shadowed by implementation" } { return 4 * n + 1; } constexpr unsigned long long -operator"" j(unsigned long long n) // { dg-warning "shadowed by implementation" } +operator"" j(unsigned long long n) // { dg-warning "1:integer suffix .j. shadowed by implementation" } { return 4 * n + 2; } constexpr unsigned long long -operator"" J(unsigned long long n) // { dg-warning "shadowed by implementation" } +operator"" J(unsigned long long n) // { dg-warning "1:integer suffix .J. shadowed by implementation" } { return 4 * n + 3; } // Floating-point imaginary... constexpr long double -operator"" i(long double n) // { dg-warning "shadowed by implementation" "" { target c++11_only } } +operator"" i(long double n) // { dg-warning "1:floating point suffix .i. shadowed by implementation" "" { target c++11_only } } { return 4.0L * n + 0.0L; } constexpr long double -operator"" I(long double n) // { dg-warning "shadowed by implementation" } +operator"" I(long double n) // { dg-warning "1:floating point suffix .I. shadowed by implementation" } { return 4.0L * n + 1.0L; } constexpr long double -operator"" j(long double n) // { dg-warning "shadowed by implementation" } +operator"" j(long double n) // { dg-warning "1:floating point suffix .j. shadowed by implementation" } { return 4.0L * n + 2.0L; } constexpr long double -operator"" J(long double n) // { dg-warning "shadowed by implementation" } +operator"" J(long double n) // { dg-warning "1:floating point suffix .J. shadowed by implementation" } { return 4.0L * n + 3.0L; } // Fixed-point... constexpr long double -operator"" k(long double n) // { dg-warning "shadowed by implementation" } +operator"" k(long double n) // { dg-warning "1:floating point suffix .k. shadowed by implementation" } { return 4 * (n + 1) + 0; } constexpr long double -operator"" K(long double n) // { dg-warning "shadowed by implementation" } +operator"" K(long double n) // { dg-warning "1:floating point suffix .K. shadowed by implementation" } { return 4 * (n + 1) + 1; } constexpr long double -operator"" r(long double n) // { dg-warning "shadowed by implementation" } +operator"" r(long double n) // { dg-warning "1:floating point suffix .r. shadowed by implementation" } { return 4 * (n + 1) + 2; } constexpr long double -operator"" R(long double n) // { dg-warning "shadowed by implementation" } +operator"" R(long double n) // { dg-warning "1:floating point suffix .R. shadowed by implementation" } { return 4 * (n + 1) + 3; } // Machine-defined... constexpr long double -operator"" w(long double n) // { dg-warning "shadowed by implementation" } +operator"" w(long double n) // { dg-warning "1:floating point suffix .w. shadowed by implementation" } { return 4 * (n + 2) + 0; } constexpr long double -operator"" W(long double n) // { dg-warning "shadowed by implementation" } +operator"" W(long double n) // { dg-warning "1:floating point suffix .W. shadowed by implementation" } { return 4 * (n + 2) + 1; } constexpr long double -operator"" q(long double n) // { dg-warning "shadowed by implementation" } +operator"" q(long double n) // { dg-warning "1:floating point suffix .q. shadowed by implementation" } { return 4 * (n + 2) + 2; } constexpr long double -operator"" Q(long double n) // { dg-warning "shadowed by implementation" } +operator"" Q(long double n) // { dg-warning "1:floating point suffix .Q. shadowed by implementation" } { return 4 * (n + 2) + 3; } int @@ -97,19 +97,19 @@ main() auto Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } } } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 7 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 11 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 15 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 19 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 25 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 29 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 33 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 37 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 43 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 47 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 51 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 55 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 61 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 65 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 69 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 73 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 7 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 11 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 15 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 19 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 25 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 29 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 33 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 37 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 43 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 47 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 51 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 55 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 61 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 65 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 69 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 73 } diff --git a/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C b/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C index ff1e7b6d966..72b8546ae58 100644 --- a/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C +++ b/gcc/testsuite/g++.dg/cpp0x/std_fext-numeric-literals.C @@ -4,73 +4,73 @@ // Integer imaginary... constexpr unsigned long long -operator"" i(unsigned long long n) // { dg-warning "shadowed by implementation" "" { target c++11_only } } +operator"" i(unsigned long long n) // { dg-warning "1:integer suffix .i. shadowed by implementation" "" { target c++11_only } } { return 4 * n + 0; } constexpr unsigned long long -operator"" I(unsigned long long n) // { dg-warning "shadowed by implementation" } +operator"" I(unsigned long long n) // { dg-warning "1:integer suffix .I. shadowed by implementation" } { return 4 * n + 1; } constexpr unsigned long long -operator"" j(unsigned long long n) // { dg-warning "shadowed by implementation" } +operator"" j(unsigned long long n) // { dg-warning "1:integer suffix .j. shadowed by implementation" } { return 4 * n + 2; } constexpr unsigned long long -operator"" J(unsigned long long n) // { dg-warning "shadowed by implementation" } +operator"" J(unsigned long long n) // { dg-warning "1:integer suffix .J. shadowed by implementation" } { return 4 * n + 3; } // Floating-point imaginary... constexpr long double -operator"" i(long double n) // { dg-warning "shadowed by implementation" "" { target c++11_only } } +operator"" i(long double n) // { dg-warning "1:floating point suffix .i. shadowed by implementation" "" { target c++11_only } } { return 4.0L * n + 0.0L; } constexpr long double -operator"" I(long double n) // { dg-warning "shadowed by implementation" } +operator"" I(long double n) // { dg-warning "1:floating point suffix .I. shadowed by implementation" } { return 4.0L * n + 1.0L; } constexpr long double -operator"" j(long double n) // { dg-warning "shadowed by implementation" } +operator"" j(long double n) // { dg-warning "1:floating point suffix .j. shadowed by implementation" } { return 4.0L * n + 2.0L; } constexpr long double -operator"" J(long double n) // { dg-warning "shadowed by implementation" } +operator"" J(long double n) // { dg-warning "1:floating point suffix .J. shadowed by implementation" } { return 4.0L * n + 3.0L; } // Fixed-point... constexpr long double -operator"" k(long double n) // { dg-warning "shadowed by implementation" } +operator"" k(long double n) // { dg-warning "1:floating point suffix .k. shadowed by implementation" } { return 4 * (n + 1) + 0; } constexpr long double -operator"" K(long double n) // { dg-warning "shadowed by implementation" } +operator"" K(long double n) // { dg-warning "1:floating point suffix .K. shadowed by implementation" } { return 4 * (n + 1) + 1; } constexpr long double -operator"" r(long double n) // { dg-warning "shadowed by implementation" } +operator"" r(long double n) // { dg-warning "1:floating point suffix .r. shadowed by implementation" } { return 4 * (n + 1) + 2; } constexpr long double -operator"" R(long double n) // { dg-warning "shadowed by implementation" } +operator"" R(long double n) // { dg-warning "1:floating point suffix .R. shadowed by implementation" } { return 4 * (n + 1) + 3; } // Machine-defined... constexpr long double -operator"" w(long double n) // { dg-warning "shadowed by implementation" } +operator"" w(long double n) // { dg-warning "1:floating point suffix .w. shadowed by implementation" } { return 4 * (n + 2) + 0; } constexpr long double -operator"" W(long double n) // { dg-warning "shadowed by implementation" } +operator"" W(long double n) // { dg-warning "1:floating point suffix .W. shadowed by implementation" } { return 4 * (n + 2) + 1; } constexpr long double -operator"" q(long double n) // { dg-warning "shadowed by implementation" } +operator"" q(long double n) // { dg-warning "1:floating point suffix .q. shadowed by implementation" } { return 4 * (n + 2) + 2; } constexpr long double -operator"" Q(long double n) // { dg-warning "shadowed by implementation" } +operator"" Q(long double n) // { dg-warning "1:floating point suffix .Q. shadowed by implementation" } { return 4 * (n + 2) + 3; } int @@ -97,19 +97,19 @@ main() auto Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } } } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 7 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 11 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 15 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 19 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 25 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 29 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 33 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 37 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 43 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 47 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 51 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 55 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 61 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 65 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 69 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 73 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 7 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 11 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 15 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 19 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 25 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 29 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 33 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 37 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 43 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 47 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 51 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 55 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 61 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 65 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 69 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 73 } diff --git a/gcc/testsuite/g++.dg/cpp0x/std_fno-ext-numeric-literals.C b/gcc/testsuite/g++.dg/cpp0x/std_fno-ext-numeric-literals.C index 0b245f4a180..b4f9d457d98 100644 --- a/gcc/testsuite/g++.dg/cpp0x/std_fno-ext-numeric-literals.C +++ b/gcc/testsuite/g++.dg/cpp0x/std_fno-ext-numeric-literals.C @@ -97,19 +97,19 @@ main() auto Qfp = 1.0Q; } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 7 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 11 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 15 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 19 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 25 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 29 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 33 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 37 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 43 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 47 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 51 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 55 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 61 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 65 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 69 } -// { dg-warning "literal operator suffixes not preceded by" "" { target *-*-* } 73 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 7 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 11 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 15 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 19 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 25 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 29 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 33 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 37 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 43 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 47 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 51 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 55 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 61 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 65 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 69 } +// { dg-warning "1:literal operator suffixes not preceded by" "" { target *-*-* } 73 } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C index d8d672e5747..b22fddd0403 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C @@ -5,37 +5,37 @@ class Foo { }; int -operator"" _Foo(); // { dg-error "has invalid argument list" } +operator"" _Foo(); // { dg-error "1:.int operator\"\"_Foo\\(\\). has invalid argument list" } Foo -operator"" _Foo(int *); // { dg-error "has invalid argument list" } +operator"" _Foo(int *); // { dg-error "1:.Foo operator\"\"_Foo\\(int\\*\\). has invalid argument list" } Foo -operator"" _Foo(unsigned long int); // { dg-error "has invalid argument list" } +operator"" _Foo(unsigned long int); // { dg-error "1:.Foo operator\"\"_Foo\\(long unsigned int\\). has invalid argument list" } Foo -operator"" _Foo(double); // { dg-error "has invalid argument list" } +operator"" _Foo(double); // { dg-error "1:.Foo operator\"\"_Foo\\(double\\). has invalid argument list" } Foo -operator"" _Foo(const float *, std::size_t); // { dg-error "has invalid argument list" } +operator"" _Foo(const float *, std::size_t); // { dg-error "1:.Foo operator\"\"_Foo\\(const float\\*, std::size_t\\). has invalid argument list" } Foo -operator"" _Foo(const wchar_t *, int); // { dg-error "has invalid argument list" } +operator"" _Foo(const wchar_t *, int); // { dg-error "1:.Foo operator\"\"_Foo\\(const wchar_t\\*, int\\). has invalid argument list" } Foo -operator"" _Foo(const char16_t *); // { dg-error "has invalid argument list" } +operator"" _Foo(const char16_t *); // { dg-error "1:.Foo operator\"\"_Foo\\(const char16_t\\*\\). has invalid argument list" } Foo -operator"" _Foo(char...); // { dg-error "has invalid argument list" } +operator"" _Foo(char...); // { dg-error "1:.Foo operator\"\"_Foo\\(char, \\.\\.\\.\\). has invalid argument list" } Foo -operator"" _Foo(unsigned long long int, char); // { dg-error "has invalid argument list" } +operator"" _Foo(unsigned long long int, char); // { dg-error "1:.Foo operator\"\"_Foo\\(long long unsigned int, char\\). has invalid argument list" } Foo -operator"" _Foo(const char *, std::size_t, int); // { dg-error "has invalid argument list" } +operator"" _Foo(const char *, std::size_t, int); // { dg-error "1:.Foo operator\"\"_Foo\\(const char\\*, std::size_t, int\\). has invalid argument list" } Foo -operator"" _Foo(long double &); // { dg-error "has invalid argument list" } +operator"" _Foo(long double &); // { dg-error "1:.Foo operator\"\"_Foo\\(long double&\\). has invalid argument list" } Foo -operator"" _Foo(std::size_t, const char16_t *); // { dg-error "has invalid argument list" } +operator"" _Foo(std::size_t, const char16_t *); // { dg-error "1:.Foo operator\"\"_Foo\\(std::size_t, const char16_t\\*\\). has invalid argument list" } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-clink-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-clink-neg.C index 87e00826eda..eb7ae8c0b17 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-clink-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-clink-neg.C @@ -3,6 +3,6 @@ extern "C" { int -operator"" _badclinkage(unsigned long long); // { dg-error "operator with C linkage" } +operator"" _badclinkage(unsigned long long); // { dg-error "1:literal operator with C linkage" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-extern-c.C b/gcc/testsuite/g++.dg/cpp0x/udlit-extern-c.C index d47a49c3fa8..7a38e12dcd0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-extern-c.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-extern-c.C @@ -2,6 +2,6 @@ extern "C" { // { dg-message "1: 'extern .C.' linkage started here" } -constexpr double operator"" _deg ( double degrees ); // { dg-error "literal operator with C linkage" } +constexpr double operator"" _deg ( double degrees ); // { dg-error "18:literal operator with C linkage" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C index b6820661e22..f2eef0f52a2 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C @@ -4,7 +4,7 @@ class Foo { public: Foo() { } - int operator"" _Bar(char32_t); // { dg-error "must be a non-member function" } + int operator"" _Bar(char32_t); // { dg-error "7:.int Foo::operator\"\"_Bar\\(char32_t\\). must be a non-member function" } }; int i = operator"" _Bar(U'x'); // { dg-error "9:'operator\"\"_Bar' was not declared in this scope" } diff --git a/gcc/testsuite/g++.dg/other/static3.C b/gcc/testsuite/g++.dg/other/static3.C new file mode 100644 index 00000000000..1d6b121b85a --- /dev/null +++ b/gcc/testsuite/g++.dg/other/static3.C @@ -0,0 +1,7 @@ +void foo() +{ + struct S + { + static const int a = 0; // { dg-error "22:local class" } + }; +} diff --git a/gcc/testsuite/g++.dg/other/static4.C b/gcc/testsuite/g++.dg/other/static4.C new file mode 100644 index 00000000000..94dc9b3d011 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/static4.C @@ -0,0 +1,6 @@ +// { dg-options -Wno-pedantic } + +void foo() +{ + static void bar(); // { dg-error "3:cannot declare static function" } +} diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-15.C b/gcc/testsuite/g++.dg/warn/Wshadow-15.C new file mode 100644 index 00000000000..57ec88124b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wshadow-15.C @@ -0,0 +1,7 @@ +// { dg-options "-Wshadow" } + +template +void* operator new(__SIZE_TYPE__, T&); // { dg-warning "7:shadowing library function" } + +template +void operator delete(void *, T&); // { dg-warning "6:shadowing library function" }