aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1fc7a1a..220a95c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5235,10 +5235,12 @@ start_decl (const cp_declarator *declarator,
{
bool ok = false;
if (CP_DECL_THREAD_LOCAL_P (decl))
- error ("%qD declared %<thread_local%> in %<constexpr%> function",
- decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "%qD declared %<thread_local%> in %<constexpr%> function",
+ decl);
else if (TREE_STATIC (decl))
- error ("%qD declared %<static%> in %<constexpr%> function", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "%qD declared %<static%> in %<constexpr%> function", decl);
else
ok = true;
if (!ok)
@@ -8253,18 +8255,18 @@ expand_static_init (tree decl, tree init)
if (CP_DECL_THREAD_LOCAL_P (decl) && DECL_GNU_TLS_P (decl)
&& !DECL_FUNCTION_SCOPE_P (decl))
{
+ location_t dloc = DECL_SOURCE_LOCATION (decl);
if (init)
- error ("non-local variable %qD declared %<__thread%> "
- "needs dynamic initialization", decl);
+ error_at (dloc, "non-local variable %qD declared %<__thread%> "
+ "needs dynamic initialization", decl);
else
- error ("non-local variable %qD declared %<__thread%> "
- "has a non-trivial destructor", decl);
+ error_at (dloc, "non-local variable %qD declared %<__thread%> "
+ "has a non-trivial destructor", decl);
static bool informed;
if (!informed)
{
- inform (DECL_SOURCE_LOCATION (decl),
- "C++11 %<thread_local%> allows dynamic initialization "
- "and destruction");
+ inform (dloc, "C++11 %<thread_local%> allows dynamic "
+ "initialization and destruction");
informed = true;
}
return;