Skip to content

Commit f03b25f

Browse files
committed
chore: Improve compatibility with gcc 13
Parse builtin type traits as primary expressions and test for __cpp_lib_mdspan before including <mdspan>. Signed-off-by: Roberto Raggi <[email protected]>
1 parent cc58f98 commit f03b25f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": 9,
2+
"version": 7,
33
"configurePresets": [
44
{
55
"name": "default",

src/parser/cxx/parser.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,9 @@ auto Parser::parse_primary_expression(ExpressionAST*& yyast,
13021302
const ExprContext& ctx) -> bool {
13031303
UnqualifiedIdAST* name = nullptr;
13041304

1305-
if (parse_this_expression(yyast)) {
1305+
if (parse_builtin_call_expression(yyast, ctx)) {
1306+
return true;
1307+
} else if (parse_this_expression(yyast)) {
13061308
return true;
13071309
} else if (parse_literal(yyast)) {
13081310
return true;
@@ -2408,9 +2410,7 @@ auto Parser::parse_postfix_expression(ExpressionAST*& yyast,
24082410

24092411
auto Parser::parse_start_of_postfix_expression(ExpressionAST*& yyast,
24102412
const ExprContext& ctx) -> bool {
2411-
if (parse_builtin_call_expression(yyast, ctx))
2412-
return true;
2413-
else if (parse_va_arg_expression(yyast, ctx))
2413+
if (parse_va_arg_expression(yyast, ctx))
24142414
return true;
24152415
else if (parse_cpp_cast_expression(yyast, ctx))
24162416
return true;

tests/manual/source.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
#include <list>
6060
#include <locale>
6161
#include <map>
62+
63+
#ifdef __cpp_lib_mdspan
6264
#include <mdspan>
65+
#endif
66+
6367
#include <memory>
6468
#include <memory_resource>
6569

0 commit comments

Comments
 (0)