@@ -274,3 +274,48 @@ TEST_F(TClingTests, ROOT10499) {
274
274
EXPECT_EQ ((void *)&errno, (void *)gInterpreter ->Calc (" &errno" ));
275
275
#endif
276
276
}
277
+
278
+ // #15511
279
+ TEST_F (TClingTests, ManyConstConstructors)
280
+ {
281
+ std::vector<int > constructors;
282
+ std::ostringstream declareConstructors;
283
+ declareConstructors << " namespace issue_15511 { auto constructors = "
284
+ << " reinterpret_cast<std::vector<int> *>(" << reinterpret_cast <uintptr_t >(&constructors)
285
+ << " ); }" ;
286
+ gInterpreter ->Declare (declareConstructors.str ().c_str ());
287
+
288
+ gInterpreter ->Declare (R"cpp(
289
+ namespace issue_15511 {
290
+ struct Constructor {
291
+ Constructor(int value) { constructors->push_back(value); }
292
+ };
293
+
294
+ const Constructor c0(0);
295
+ const Constructor c1(1);
296
+ const Constructor c2(2);
297
+ const Constructor c3(3);
298
+ const Constructor c4(4);
299
+ const Constructor c5(5);
300
+ const Constructor c6(6);
301
+ const Constructor c7(7);
302
+ const Constructor c8(8);
303
+ const Constructor c9(9);
304
+ const Constructor c10(10);
305
+ const Constructor c11(11);
306
+ const Constructor c12(12);
307
+ const Constructor c13(13);
308
+ const Constructor c14(14);
309
+ const Constructor c15(15);
310
+ const Constructor c16(16);
311
+ const Constructor c17(17);
312
+ const Constructor c18(18);
313
+ const Constructor c19(19);
314
+ }
315
+ )cpp" );
316
+
317
+ ASSERT_EQ (constructors.size (), 20 );
318
+ for (int i = 0 ; i < 20 ; i++) {
319
+ EXPECT_EQ (constructors[i], i);
320
+ }
321
+ }
0 commit comments