diff --git a/.github/workflows/build-cppfront.yaml b/.github/workflows/build-cppfront.yaml index d1282924cd..c19564e98a 100644 --- a/.github/workflows/build-cppfront.yaml +++ b/.github/workflows/build-cppfront.yaml @@ -38,6 +38,9 @@ jobs: - runs-on: macos-latest compiler: clang++ cxx-std: 'c++20' + - runs-on: ubuntu-22.04 + compiler: clang++-15 + cxx-std: 'c++20' - runs-on: ubuntu-24.04 compiler: clang++-16 cxx-std: 'c++20' @@ -47,6 +50,9 @@ jobs: - runs-on: ubuntu-24.04 compiler: clang++-18 cxx-std: 'c++20' + - runs-on: ubuntu-24.04 + compiler: clang++-18 + cxx-std: 'c++2b' - runs-on: ubuntu-24.04 compiler: g++-14 cxx-std: 'c++2b' diff --git a/source/parse.h b/source/parse.h index 0c35215c80..9ff0033b79 100644 --- a/source/parse.h +++ b/source/parse.h @@ -141,6 +141,9 @@ struct primary_expression_node // Cache to work around . bool expression_list_is_fold_expression = false; + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used in a std::unique_ptr as a member + ~primary_expression_node(); // API // @@ -234,6 +237,10 @@ struct prefix_expression_node std::vector ops; std::unique_ptr expr; + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used in a std::unique_ptr as a member + ~prefix_expression_node(); + // API // auto is_fold_expression() const @@ -293,6 +300,10 @@ struct binary_expression_node binary_expression_node(); + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used as Term in a std::unique_ptr as a member + ~binary_expression_node(); + struct term { token const* op; @@ -1087,6 +1098,18 @@ struct template_argument std::unique_ptr > arg; + // The type needs to be movable + // The copy ctor+operator are implicitly deleted due to the std::unique_ptr member + // Because a forward-declared type is used in a std::unique_ptr as a member an out-of-line dtor is necessary + // Because of the OOL dtor together with the fact that the copy ctor+operator are deleted + // the move ctor+operator need to be explicitly defaulted + // As a result the default constructor also needs to be explicitly defaulted + template_argument() = default; + template_argument(template_argument&&) = default; + template_argument& operator=(template_argument&&) = default; + + ~template_argument(); + auto to_string() const -> std::string; }; @@ -1800,6 +1823,10 @@ struct iteration_statement_node std::unique_ptr body; // used for "for", else null bool for_with_in = false;// used for "for," says whether loop variable is 'in' + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used in a std::unique_ptr as a member + ~iteration_statement_node(); + auto position() const -> source_position { @@ -1851,6 +1878,10 @@ struct alternative_node source_position equal_sign; std::unique_ptr statement; + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used in a std::unique_ptr as a member + ~alternative_node(); + auto position() const -> source_position { @@ -1874,6 +1905,10 @@ struct inspect_expression_node std::vector> alternatives; + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used in a std::unique_ptr as a member + ~inspect_expression_node(); + auto position() const -> source_position { @@ -2011,6 +2046,10 @@ struct statement_node statement_node(compound_statement_node* compound_parent_ = nullptr); + // Out-of-line definition of the dtor is necessary due to the forward-declared + // type(s) used in a std::unique_ptr as a member + ~statement_node(); + enum active { expression=0, compound, selection, declaration, return_, iteration, using_, contract, inspect, jump }; std::variant< std::unique_ptr, @@ -4386,6 +4425,26 @@ struct translation_unit_node } }; +// Definitions of out-of-line dtors for nodes with unique_ptr members of forward-declared types +primary_expression_node::~primary_expression_node() = default; + +prefix_expression_node::~prefix_expression_node() = default; + +template< + String Name, + typename Term +> +binary_expression_node::~binary_expression_node() = default; + +alternative_node::~alternative_node() = default; + +iteration_statement_node::~iteration_statement_node() = default; + +template_argument::~template_argument() = default; + +inspect_expression_node::~inspect_expression_node() = default; + +statement_node::~statement_node() = default; //----------------------------------------------------------------------- //