# Default constructor more strict for parametric type?

**URL:** <https://discourse.julialang.org/t/default-constructor-more-strict-for-parametric-type/6690>\
**Category:** General Usage\
**Created:** [October 25, 2017, 11:02pm UTC](https://discourse.julialang.org/t/default-constructor-more-strict-for-parametric-type/6690 "2017-10-25T23:02:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggggggggg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ggggggggg/32/265_2.png) [@ggggggggg](https://discourse.julialang.org/u/ggggggggg)\
**Post date:** [October 25, 2017, 11:02pm UTC](https://discourse.julialang.org/t/default-constructor-more-strict-for-parametric-type/6690/1 "2017-10-25T23:02:50Z")

</div>

Why can’t `B` accept two `Int` arguments, when `A` can? The answer is that a method `A(a,b)` exists, but a method `B(a::T, b) where T<:Real` does not exist. Is there a good reason for that? I have some code where I have many members of a few different types, and I don’t want to write these methods by hand, has anybody made a macro that creates the wider signature method?

```julia
julia> struct A
       a::Float64
       b::Float64
       end

julia> A(1,1)
A(1.0, 1.0)

julia> struct B{T<:Real}
       a::T
       b::Float64
       end

julia> B(1,1)
ERROR: MethodError: no method matching B(::Int64, ::Int64)
Closest candidates are:
  B(::T<:Real, ::Float64) where T<:Real at REPL[3]:2

```

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [October 25, 2017, 11:30pm UTC](https://discourse.julialang.org/t/default-constructor-more-strict-for-parametric-type/6690/2 "2017-10-25T23:30:32Z")

</div>

[https://github.com/JuliaLang/julia/issues/17186](https://github.com/JuliaLang/julia/issues/17186)
