[Issue 869] New: Cast of a parenthesized expression combined with !is is mistaken for a C style cast and a template specialization

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 21 06:42:08 PST 2007


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

           Summary: Cast of a parenthesized expression combined with !is is
                    mistaken for a C style cast and a template
                    specialization
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com


static assert (cast(int)(foo) !is null);
// or with normal assert:
void main() { assert (cast(int)(foo) !is null); }

The above code snippet produces, for both lines 1 and 3, the following pair of
errors:

(type identifier : specialization) expected following is
C style cast illegal, use cast(foo)!0

It's easy to work around: either remove the parentheses around foo or add
another pair of them, whichever is appropriate for the expression.


-- 



More information about the Digitalmars-d-bugs mailing list