From 2cc2773a19e076ea48f386bc770a4b13d0d34fd2 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 9 Jan 2025 21:31:14 +0100 Subject: [PATCH] chore: Improve compatibility with gcc 13 Parse builtin type traits as primary expressions and test for __cpp_lib_mdspan before including . Signed-off-by: Roberto Raggi --- CMakePresets.json | 2 +- src/parser/cxx/parser.cc | 8 ++++---- tests/manual/source.cc | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index f7a2eaee..6fe5bd67 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,5 +1,5 @@ { - "version": 9, + "version": 7, "configurePresets": [ { "name": "default", diff --git a/src/parser/cxx/parser.cc b/src/parser/cxx/parser.cc index c0b9f2dc..cbc372f7 100644 --- a/src/parser/cxx/parser.cc +++ b/src/parser/cxx/parser.cc @@ -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; @@ -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; diff --git a/tests/manual/source.cc b/tests/manual/source.cc index 2f633536..0c83fef6 100644 --- a/tests/manual/source.cc +++ b/tests/manual/source.cc @@ -59,7 +59,11 @@ #include #include #include + +#ifdef __cpp_lib_mdspan #include +#endif + #include #include