Defining an outer constructor leads to infinite recursion

As explained by @lmiq ,@sgaure and @Benny you should probably just create an inner constructor here, but to directly answer this question, you could invoke the Tuple{Any, Any} constructor:

struct OtherOrderedPair
    x::Real
    y::Real
end

function OtherOrderedPair(x::Real, y::Real)
    if x > y
        error("bad order 2")
    else
        invoke(OtherOrderedPair, Tuple{Any, Any}, x, y)
    end
end
julia> OtherOrderedPair(2, 1)
ERROR: bad order 2
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] OtherOrderedPair(x::Int64, y::Int64)
   @ Main .\REPL[2]:3
 [3] top-level scope
   @ REPL[4]:1

julia> OtherOrderedPair(1, 2)
OtherOrderedPair(1, 2)
1 Like