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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 8 10:34:41 PST 2008


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


gide at nwawudu.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Comment #4 from gide at nwawudu.com  2008-11-08 12:34 -------
const should be added to the variable declaration, so the error message is
correct. Add const and it works in DMD 2.020 and 1.033.

module bug ;

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

void main () {
  const ulong a = 1_LU ; // <- added const

  auto omega = foo!(a);
}


-- 



More information about the Digitalmars-d-bugs mailing list