[Issue 772] New: Bogus error using relation operator as static if expression within template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 29 22:42:46 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=772

           Summary: Bogus error using relation operator as static if
                    expression within template
           Product: D
           Version: 0.178
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: ibisbasenji at gmail.com


Given the following useless test program...
--------------------------------------------------
module bug ;

template foo (ulong n) {
  static if (n < 10_LU) {
    const foo = n ;
  }
  else {
    const foo = n % 10 ;
  }
}

void main () {
  ulong a = 1_LU ;

  auto omega = foo!(a);
}
--------------------------------------------------

The compiler will output:
bug.d(4): Error: expression (a) < 10LU does not evaluate to a boolean
bug.d(15): template instance bool0.main.foo!(a) error instantiating


-- 



More information about the Digitalmars-d-bugs mailing list