Commit 556e63dd authored by Kenton Varda's avatar Kenton Varda

Fixes #402

parent 3b7c81a2
......@@ -1901,6 +1901,15 @@ TEST(Encoding, UnionInGenerics) {
builder.initUg();
}
TEST(Encoding, DefaultListBuilder) {
// At one point, this wouldn't compile.
List<int>::Builder(nullptr);
List<TestAllTypes>::Builder(nullptr);
List<List<int>>::Builder(nullptr);
List<Text>::Builder(nullptr);
}
} // namespace
} // namespace _ (private)
} // namespace capnp
......@@ -140,7 +140,7 @@ struct List<T, Kind::PRIMITIVE> {
typedef List<T> Builds;
inline Builder(): builder(_::elementSizeForType<T>()) {}
inline Builder(decltype(nullptr)) {}
inline Builder(decltype(nullptr)): Builder() {}
inline explicit Builder(_::ListBuilder builder): builder(builder) {}
inline operator Reader() const { return Reader(builder.asReader()); }
......@@ -236,7 +236,7 @@ struct List<T, Kind::STRUCT> {
typedef List<T> Builds;
inline Builder(): builder(ElementSize::INLINE_COMPOSITE) {}
inline Builder(decltype(nullptr)) {}
inline Builder(decltype(nullptr)): Builder() {}
inline explicit Builder(_::ListBuilder builder): builder(builder) {}
inline operator Reader() const { return Reader(builder.asReader()); }
......@@ -359,7 +359,7 @@ struct List<List<T>, Kind::LIST> {
typedef List<List<T>> Builds;
inline Builder(): builder(ElementSize::POINTER) {}
inline Builder(decltype(nullptr)) {}
inline Builder(decltype(nullptr)): Builder() {}
inline explicit Builder(_::ListBuilder builder): builder(builder) {}
inline operator Reader() const { return Reader(builder.asReader()); }
......@@ -467,7 +467,7 @@ struct List<T, Kind::BLOB> {
typedef List<T> Builds;
inline Builder(): builder(ElementSize::POINTER) {}
inline Builder(decltype(nullptr)) {}
inline Builder(decltype(nullptr)): Builder() {}
inline explicit Builder(_::ListBuilder builder): builder(builder) {}
inline operator Reader() const { return Reader(builder.asReader()); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment