mirror of
https://github.com/dlang/dmd.git
synced 2025-04-28 22:20:37 +03:00
fix Issue 23715 - ImportC: No rejection of _Thread_local variables declared at function scope without 'static' as per C11 6.2.4-5 (#15094)
This commit is contained in:
parent
b571a1a118
commit
5cd6f80d06
3 changed files with 19 additions and 1 deletions
|
@ -2544,6 +2544,12 @@ final class CParser(AST) : Parser!AST
|
|||
error("`inline` and `_Noreturn` function specifiers not allowed for `_Thread_local`");
|
||||
scw &= ~scwx;
|
||||
}
|
||||
if (level == LVL.local &&
|
||||
scw & (SCW.x_Thread_local) && !(scw & (SCW.xstatic | SCW.xextern)))
|
||||
{
|
||||
error("`_Thread_local` in block scope must be accompanied with `static` or `extern`"); // C11 6.7.1-3
|
||||
scw &= ~scwx;
|
||||
}
|
||||
if (level & (LVL.parameter | LVL.prototype) &&
|
||||
scw & ~SCW.xregister)
|
||||
{
|
||||
|
|
|
@ -277,7 +277,7 @@ void test2()
|
|||
typedef int TI;
|
||||
//extern int ei;
|
||||
static int si;
|
||||
_Thread_local int tli;
|
||||
static _Thread_local int tli;
|
||||
int __declspec(thread) tlj;
|
||||
auto int ai;
|
||||
register int reg;
|
||||
|
|
12
compiler/test/fail_compilation/test23715.i
Normal file
12
compiler/test/fail_compilation/test23715.i
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/test23715.i(11): Error: `_Thread_local` in block scope must be accompanied with `static` or `extern`
|
||||
---
|
||||
*/
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23715
|
||||
|
||||
void test2()
|
||||
{
|
||||
_Thread_local int tli;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue