Skip to content

Commit c95f480

Browse files
committed
Remove default zero-arg constructor
This is necessary to allow definitions that don't contain any named fields
1 parent 4028012 commit c95f480

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/FieldFlags.jl

+1-4
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,7 @@ function bitfield(expr::Expr)
208208
# requested struct is declared `mutable` as well
209209
internal_constructor = Expr(:(=), Expr(:call, typename, Expr(:(::), :t, Ti)), Expr(:new, T, :t))
210210
newob = Expr(:new, T, :(FieldFlags.cast_or_extend($Ti, 0x0)))
211-
zero_arg_constr = Expr(:(=),
212-
Expr(:call, typename),
213-
newob)
214-
struct_body = Expr(:block, Expr(:(::), :fields, Ti), internal_constructor, zero_arg_constr)
211+
struct_body = Expr(:block, Expr(:(::), :fields, Ti), internal_constructor)
215212
mutstruct = Expr(:struct, mutable, suptype, struct_body)
216213
typedefs = Expr(:block, :(primitive type $typename_internal $typesize end), mutstruct)
217214

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end
6060
struct Wrapper_10{T}
6161
c::Convert_10
6262
end
63-
obj = Convert_10()
63+
obj = zero(Convert_10)
6464
@test Wrapper_10{Int}(obj) isa Wrapper_10{Int}
6565
end
6666

0 commit comments

Comments
 (0)