Skip to content

Commit 55e49a0

Browse files
add constexpr to tests for vector(recursive.cc)
- which matches production situation better.
1 parent 63a6299 commit 55e49a0

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

tests/0026.container/0001.vector/recursive.cc

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ struct Node2
1212
{
1313
fast_io::vector<Base> subast;
1414

15-
Node2();
16-
Node2(fast_io::vector<Base> sub);
17-
~Node2();
15+
constexpr Node2();
16+
constexpr Node2(fast_io::vector<Base> sub);
17+
constexpr ~Node2();
18+
19+
template <typename>
20+
constexpr int a_method(int) const noexcept;
1821
};
1922

2023
struct Base
@@ -30,10 +33,16 @@ struct Base
3033
{}
3134
};
3235

33-
Node2::Node2() = default;
34-
Node2::Node2(fast_io::vector<Base> sub) : subast(std::move(sub))
36+
constexpr Node2::Node2() = default;
37+
constexpr Node2::Node2(fast_io::vector<Base> sub) : subast(std::move(sub))
3538
{}
36-
Node2::~Node2() = default;
39+
constexpr Node2::~Node2() = default;
40+
41+
template <typename>
42+
constexpr int Node2::a_method(int) const noexcept
43+
{
44+
return 42;
45+
}
3746

3847
using Ast = fast_io::vector<Base>;
3948

@@ -58,6 +67,11 @@ int main()
5867
}
5968
else if constexpr (std::is_same_v<T, Node2>)
6069
{
70+
int const v{n.template a_method<int>(0)};
71+
if (v != 42)
72+
{
73+
::fast_io::fast_terminate();
74+
}
6175
}
6276
else if constexpr (std::is_same_v<T, Node3>)
6377
{

0 commit comments

Comments
 (0)