File tree 11 files changed +10
-51
lines changed
inequality-with-constant-normalisation1
11 files changed +10
-51
lines changed Original file line number Diff line number Diff line change 1
-
2
- // Not yet available in Visual Studio
3
-
4
- #ifdef _MSC_VER
5
-
6
- int main ()
7
- {
8
- }
9
-
10
- #else
11
-
12
1
struct S
13
2
{
3
+ // Visual Studio does not support _Static_assert in compound bodies.
4
+ #ifndef _MSC_VER
14
5
_Static_assert (1 , "in struct ");
6
+ #endif
15
7
int x ;
16
8
} asd ;
17
9
@@ -21,5 +13,3 @@ int main()
21
13
{
22
14
_Static_assert (1 , "in function" );
23
15
}
24
-
25
- #endif
Original file line number Diff line number Diff line change 1
- CORE gcc-only
1
+ CORE
2
2
global.c
3
3
4
4
static assertion failed: must fail
Original file line number Diff line number Diff line change 1
- CORE gcc-only
1
+ CORE
2
2
local.c
3
3
4
4
static assertion failed: must fail
Original file line number Diff line number Diff line change 1
- CORE gcc-only
1
+ CORE
2
2
not_constant.c
3
3
4
4
expected constant expression
Original file line number Diff line number Diff line change 1
- #ifdef _MSC_VER
2
- // No _Static_assert in Visual Studio
3
- # define _Static_assert (condition , message ) static_assert(condition, message)
4
- #endif
5
-
6
1
struct S
7
2
{
8
3
struct
Original file line number Diff line number Diff line change 1
- #ifdef _MSC_VER
2
- # define _Static_assert static_assert
3
- #endif
4
-
5
1
int main ()
6
2
{
7
3
_Static_assert (!__CPROVER_overflow_plus (1 , 2 ), "" );
Original file line number Diff line number Diff line change 1
- #ifdef _MSC_VER
2
-
3
- // No _Static_assert in Visual Studio
4
- #define _Static_assert (condition , message ) \
5
- int some_array##__LINE__[(condition) ? 1 : -1];
6
-
7
- #endif
8
-
9
1
// sizeof is unsigned
10
2
_Static_assert ( 1 - sizeof (int ) >=0 , "sizeof is unsigned" );
11
3
Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ struct S0
7
7
int x ;
8
8
};
9
9
10
- #ifdef _MSC_VER
11
- # define _Static_assert static_assert
12
- #endif
13
-
14
10
int main ()
15
11
{
16
12
struct S0 g = {0 };
Original file line number Diff line number Diff line change 1
1
#include <assert.h>
2
2
3
- #ifdef _MSC_VER
4
- # define _Static_assert (x , m ) static_assert(x, m)
5
- #endif
6
-
7
3
int main ()
8
4
{
9
5
_Bool b1 , b2 ;
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ struct S
8
8
};
9
9
#pragma pack(pop)
10
10
11
- #ifdef _MSC_VER
12
- # define _Static_assert (x , m ) static_assert(x, m)
13
- #endif
14
-
15
11
int main ()
16
12
{
17
13
int A [3 ];
Original file line number Diff line number Diff line change @@ -876,8 +876,9 @@ or_eq { return cpp98_keyword(TOK_ORASSIGN); }
876
876
private { return cpp98_keyword (TOK_PRIVATE); }
877
877
protected { return cpp98_keyword (TOK_PROTECTED); }
878
878
public { return cpp98_keyword (TOK_PUBLIC); }
879
- static_assert { // C++11, but Visual Studio supports it in all modes (and
880
- // doesn't support _Static_assert)
879
+ static_assert { // C++11, but Visual Studio supports it in all modes
880
+ // as a keyword, even though the documentation claims
881
+ // it's a macro.
881
882
if (PARSER.mode == configt::ansi_ct::flavourt::VISUAL_STUDIO)
882
883
{
883
884
loc (); return TOK_STATIC_ASSERT;
@@ -1490,10 +1491,7 @@ __decltype { if(PARSER.cpp98 &&
1490
1491
1491
1492
/* This is a C11 keyword */
1492
1493
1493
- " _Static_assert" { if (!PARSER.cpp98 &&
1494
- (PARSER.mode ==configt::ansi_ct::flavourt::GCC ||
1495
- PARSER.mode ==configt::ansi_ct::flavourt::CLANG ||
1496
- PARSER.mode ==configt::ansi_ct::flavourt::ARM))
1494
+ " _Static_assert" { if (!PARSER.cpp98 )
1497
1495
{ loc (); return TOK_STATIC_ASSERT; }
1498
1496
else
1499
1497
return make_identifier ();
You can’t perform that action at this time.
0 commit comments