Skip to content

Commit

Permalink
chore: Improve compatibility with gcc 13
Browse files Browse the repository at this point in the history
Parse builtin type traits as primary expressions
and test for __cpp_lib_mdspan before including
<mdspan>.

Signed-off-by: Roberto Raggi <[email protected]>
  • Loading branch information
robertoraggi committed Jan 9, 2025
1 parent cc58f98 commit 2cc2773
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 9,
"version": 7,
"configurePresets": [
{
"name": "default",
Expand Down
8 changes: 4 additions & 4 deletions src/parser/cxx/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,9 @@ auto Parser::parse_primary_expression(ExpressionAST*& yyast,
const ExprContext& ctx) -> bool {
UnqualifiedIdAST* name = nullptr;

if (parse_this_expression(yyast)) {
if (parse_builtin_call_expression(yyast, ctx)) {
return true;
} else if (parse_this_expression(yyast)) {
return true;
} else if (parse_literal(yyast)) {
return true;
Expand Down Expand Up @@ -2408,9 +2410,7 @@ auto Parser::parse_postfix_expression(ExpressionAST*& yyast,

auto Parser::parse_start_of_postfix_expression(ExpressionAST*& yyast,
const ExprContext& ctx) -> bool {
if (parse_builtin_call_expression(yyast, ctx))
return true;
else if (parse_va_arg_expression(yyast, ctx))
if (parse_va_arg_expression(yyast, ctx))
return true;
else if (parse_cpp_cast_expression(yyast, ctx))
return true;
Expand Down
4 changes: 4 additions & 0 deletions tests/manual/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
#include <list>
#include <locale>
#include <map>

#ifdef __cpp_lib_mdspan
#include <mdspan>
#endif

#include <memory>
#include <memory_resource>

Expand Down

0 comments on commit 2cc2773

Please sign in to comment.