@@ -141,6 +141,9 @@ struct primary_expression_node
141
141
// Cache to work around <https://github.com/llvm/llvm-project/issues/73336>.
142
142
bool expression_list_is_fold_expression = false ;
143
143
144
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
145
+ // type(s) used in a std::unique_ptr as a member
146
+ ~primary_expression_node ();
144
147
145
148
// API
146
149
//
@@ -234,6 +237,10 @@ struct prefix_expression_node
234
237
std::vector<token const *> ops;
235
238
std::unique_ptr<postfix_expression_node> expr;
236
239
240
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
241
+ // type(s) used in a std::unique_ptr as a member
242
+ ~prefix_expression_node ();
243
+
237
244
// API
238
245
//
239
246
auto is_fold_expression () const
@@ -293,6 +300,10 @@ struct binary_expression_node
293
300
294
301
binary_expression_node ();
295
302
303
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
304
+ // type(s) used as Term in a std::unique_ptr as a member
305
+ ~binary_expression_node ();
306
+
296
307
struct term
297
308
{
298
309
token const * op;
@@ -1087,6 +1098,18 @@ struct template_argument
1087
1098
std::unique_ptr<type_id_node>
1088
1099
> arg;
1089
1100
1101
+ // The type needs to be movable
1102
+ // The copy ctor+operator are implicitly deleted due to the std::unique_ptr member
1103
+ // Because a forward-declared type is used in a std::unique_ptr as a member an out-of-line dtor is necessary
1104
+ // Because of the OOL dtor together with the fact that the copy ctor+operator are deleted
1105
+ // the move ctor+operator need to be explicitly defaulted
1106
+ // As a result the default constructor also needs to be explicitly defaulted
1107
+ template_argument () = default ;
1108
+ template_argument (template_argument&&) = default ;
1109
+ template_argument& operator =(template_argument&&) = default ;
1110
+
1111
+ ~template_argument ();
1112
+
1090
1113
auto to_string () const
1091
1114
-> std::string;
1092
1115
};
@@ -1800,6 +1823,10 @@ struct iteration_statement_node
1800
1823
std::unique_ptr<statement_node> body; // used for "for", else null
1801
1824
bool for_with_in = false ;// used for "for," says whether loop variable is 'in'
1802
1825
1826
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
1827
+ // type(s) used in a std::unique_ptr as a member
1828
+ ~iteration_statement_node ();
1829
+
1803
1830
auto position () const
1804
1831
-> source_position
1805
1832
{
@@ -1851,6 +1878,10 @@ struct alternative_node
1851
1878
source_position equal_sign;
1852
1879
std::unique_ptr<statement_node> statement;
1853
1880
1881
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
1882
+ // type(s) used in a std::unique_ptr as a member
1883
+ ~alternative_node ();
1884
+
1854
1885
auto position () const
1855
1886
-> source_position
1856
1887
{
@@ -1874,6 +1905,10 @@ struct inspect_expression_node
1874
1905
1875
1906
std::vector<std::unique_ptr<alternative_node>> alternatives;
1876
1907
1908
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
1909
+ // type(s) used in a std::unique_ptr as a member
1910
+ ~inspect_expression_node ();
1911
+
1877
1912
auto position () const
1878
1913
-> source_position
1879
1914
{
@@ -2011,6 +2046,10 @@ struct statement_node
2011
2046
2012
2047
statement_node (compound_statement_node* compound_parent_ = nullptr );
2013
2048
2049
+ // Out-of-line definition of the dtor is necessary due to the forward-declared
2050
+ // type(s) used in a std::unique_ptr as a member
2051
+ ~statement_node ();
2052
+
2014
2053
enum active { expression=0 , compound , selection, declaration, return_, iteration, using_, contract, inspect, jump };
2015
2054
std::variant<
2016
2055
std::unique_ptr<expression_statement_node>,
@@ -4386,6 +4425,26 @@ struct translation_unit_node
4386
4425
}
4387
4426
};
4388
4427
4428
+ // Definitions of out-of-line dtors for nodes with unique_ptr members of forward-declared types
4429
+ primary_expression_node::~primary_expression_node () = default ;
4430
+
4431
+ prefix_expression_node::~prefix_expression_node () = default ;
4432
+
4433
+ template <
4434
+ String Name,
4435
+ typename Term
4436
+ >
4437
+ binary_expression_node<Name, Term>::~binary_expression_node () = default ;
4438
+
4439
+ alternative_node::~alternative_node () = default ;
4440
+
4441
+ iteration_statement_node::~iteration_statement_node () = default ;
4442
+
4443
+ template_argument::~template_argument () = default ;
4444
+
4445
+ inspect_expression_node::~inspect_expression_node () = default ;
4446
+
4447
+ statement_node::~statement_node () = default ;
4389
4448
4390
4449
// -----------------------------------------------------------------------
4391
4450
//
0 commit comments