How to test whether comparison is defined for a type?

I think the reason your code is failing is because hasmethod(<,(Real,Real)) is true, and you have defined Mod29 as a subtype of Real. Is that subtyping necessary? When you declare a subtype like this, you are making an implicit promise to support all the methods that go with Real.

One “julian” technique to deal with this problem is to define some new methods:

   haslessthan(::Any) = false
   haslessthan(::Real) = true
   haslessthan(::Mod29) = false

and then dispatch your gaussian elimination on Val{haslessthan(eltype(A))} where A is the matrix. If done correctly, the dispatch is all computed at compile time so there is no run-time overhead in determining which is the correct gaussian elimination method.