Commit be68f3fa by Paolo Carlini Committed by Paolo Carlini

decl.c (bad_specifiers): Add const location_t* parameter and use locations in…

decl.c (bad_specifiers): Add const location_t* parameter and use locations in error messages about...

/cp
2018-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (bad_specifiers): Add const location_t* parameter and
	use locations in error messages about 'inline' and 'virtual'.
	(mark_inline_variable): Add location_t parameter and use it in
	error_at and pedwarn messages.
	(grokdeclarator): Use declspecs->locations[ds_constexpr],
	declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
	declspecs->locations[ds_inline] in many error messages; adjust
	bad_specifiers and mark_inline_variable calls.
	(grokvardecl): Use declspecs->locations[ds_concept] in error message.

/testsuite
2018-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/concepts/locations1.C: New.
	* g++.dg/cpp0x/locations1.C: Likewise.
	* g++.dg/cpp1z/inline-var2.C: Test locations too.
	* g++.dg/cpp1z/inline-var3.C: Likewise.

From-SVN: r261982
parent 9f8a749e
2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (bad_specifiers): Add const location_t* parameter and
use locations in error messages about 'inline' and 'virtual'.
(mark_inline_variable): Add location_t parameter and use it in
error_at and pedwarn messages.
(grokdeclarator): Use declspecs->locations[ds_constexpr],
declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
declspecs->locations[ds_inline] in many error messages; adjust
bad_specifiers and mark_inline_variable calls.
(grokvardecl): Use declspecs->locations[ds_concept] in error message.
2018-06-22 Jason Merrill <jason@redhat.com>
PR c++/86219 - ICE with erroneous initializer in template.
......
2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/concepts/locations1.C: New.
* g++.dg/cpp0x/locations1.C: Likewise.
* g++.dg/cpp1z/inline-var2.C: Test locations too.
* g++.dg/cpp1z/inline-var3.C: Likewise.
2018-06-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/86281
......
// { dg-additional-options "-std=c++17 -fconcepts" }
struct S
{
concept S(); // { dg-error "3:a constructor cannot be .concept." }
concept int s = 1; // { dg-error "3:non-static data member .s. declared .concept." }
concept void foo(); // { dg-error "3:a concept cannot be a member function" }
concept ~S(); // { dg-error "3:a destructor cannot be .concept." }
};
typedef concept int my_int; // { dg-error "9:.concept. cannot appear in a typedef declaration" }
void bar(concept int); // { dg-error "10:a parameter cannot be declared .concept." }
concept int i = 0; // { dg-error "1:a non-template variable cannot be .concept." }
// { dg-do compile { target c++11 } }
void foo()
{
static void bar1(); // { dg-error "3:.static. specifier invalid" }
// { dg-error "3:cannot declare static function" "" { target *-*-* } .-1 }
inline void bar2(); // { dg-error "3:.inline. specifier invalid" }
}
struct S
{
virtual S(); // { dg-error "3:constructors cannot be declared .virtual." }
constexpr int s = 1; // { dg-error "3:non-static data member .s. declared .constexpr." }
constexpr ~S(); // { dg-error "3:a destructor cannot be .constexpr." }
};
typedef constexpr int my_int; // { dg-error "9:.constexpr. cannot appear in a typedef declaration" }
union U
{
virtual void foo(); // { dg-error "3:function .foo. declared .virtual. inside a union" }
};
struct T
{
virtual void operator delete(void*); // { dg-error "3:.operator delete. cannot be declared .virtual." }
};
void bar(constexpr int); // { dg-error "10:a parameter cannot be declared .constexpr." }
......@@ -4,39 +4,39 @@
// aren't emitted into assembly even at -O0.
// { dg-final { scan-assembler-not "inlvarvariable" } }
inline int inlvarvariable1 = 1; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
const inline int inlvarvariable2 = 2; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
inline int inlvarvariable1 = 1; // { dg-warning "1:inline variables are only available with" "" { target c++14_down } }
const inline int inlvarvariable2 = 2; // { dg-warning "7:inline variables are only available with" "" { target c++14_down } }
namespace N
{
int inline inlvarvariable3; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
const int inline inlvarvariable4 = 4; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
int inline inlvarvariable3; // { dg-warning "7:inline variables are only available with" "" { target c++14_down } }
const int inline inlvarvariable4 = 4; // { dg-warning "13:inline variables are only available with" "" { target c++14_down } }
}
struct S
{
static inline double inlvarvariable5 = 5.0; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
static inline double inlvarvariable5 = 5.0; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } }
#if __cplusplus >= 201103L
static constexpr int inlvarvariable6 = 6;
static inline constexpr int inlvarvariable7 = 7; // { dg-warning "inline variables are only available with" "" { target { c++11 && c++14_down } } }
static inline constexpr int inlvarvariable7 = 7; // { dg-warning "10:inline variables are only available with" "" { target { c++11 && c++14_down } } }
#endif
};
template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
inline int inlvarvariable8; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
inline int inlvarvariable8; // { dg-warning "1:inline variables are only available with" "" { target c++14_down } }
template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
const int inline inlvarvariable9 = 9; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
const int inline inlvarvariable9 = 9; // { dg-warning "11:inline variables are only available with" "" { target c++14_down } }
namespace N
{
template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
int inline inlvarvariable10 = 10; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
int inline inlvarvariable10 = 10; // { dg-warning "7:inline variables are only available with" "" { target c++14_down } }
template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
const inline double inlvarvariable11 = 11.0; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
const inline double inlvarvariable11 = 11.0; // { dg-warning "9:inline variables are only available with" "" { target c++14_down } }
}
template <int N>
struct T
{
static inline int inlvarvariable12 = 12; // { dg-warning "inline variables are only available with" "" { target c++14_down } }
static inline int inlvarvariable12 = 12; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } }
#if __cplusplus >= 201103L
static constexpr int inlvarvariable13 = 13;
static inline constexpr double inlvarvariable14 = 14.0; // { dg-warning "inline variables are only available with" "" { target { c++11 && c++14_down } } }
static inline constexpr double inlvarvariable14 = 14.0; // { dg-warning "10:inline variables are only available with" "" { target { c++11 && c++14_down } } }
#endif
};
#if __cplusplus < 201103L
......
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