Fixed: FP return reference to thread_local variable (#1758)
This commit is contained in:
parent
88dc74929a
commit
574b77cf1f
|
@ -9765,9 +9765,11 @@ void Tokenizer::simplifyKeyword()
|
||||||
Token::createMutualLinks(braceStart, braceEnd);
|
Token::createMutualLinks(braceStart, braceEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) thread_local
|
// 3) thread_local -> static
|
||||||
|
// on single thread thread_local has the effect of static
|
||||||
else if (tok->str() == "thread_local") {
|
else if (tok->str() == "thread_local") {
|
||||||
tok->deleteThis();
|
tok->originalName(tok->str());
|
||||||
|
tok->str("static");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -882,6 +882,13 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("std::vector<int> &foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" thread_local std::vector<int> v;\n"
|
||||||
|
" return v;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("std::string hello()\n"
|
check("std::string hello()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return \"hello\";\n"
|
" return \"hello\";\n"
|
||||||
|
|
|
@ -4132,7 +4132,7 @@ private:
|
||||||
// Ticket #8679
|
// Ticket #8679
|
||||||
const char code[] = "thread_local void *thread_local_var; "
|
const char code[] = "thread_local void *thread_local_var; "
|
||||||
"__thread void *thread_local_var_2;";
|
"__thread void *thread_local_var_2;";
|
||||||
ASSERT_EQUALS("void * thread_local_var ; "
|
ASSERT_EQUALS("static void * thread_local_var ; "
|
||||||
"void * thread_local_var_2 ;", tokenizeAndStringify(code));
|
"void * thread_local_var_2 ;", tokenizeAndStringify(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue