Summary: Header generation turns 'typeof(x)(...)' into C-style
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Lars T. Kyllingstad <> 2010-08-09 
03:48:33 PDT ---
When typeof(x)(...) is used as a struct literal, the compiler adds parentheses
around typeof(x) in the generated .di file.  When the .di file is later used,
the compiler interprets (typeof(x)) as a C-style cast.

I tend to use

   return typeof(return)(...);

a lot in generic code, and this issue makes header files completely unusable to

Test case:

$ cat test.d
struct S { int i; }
S foo() { return typeof(return)(123); }

$ dmd -c -o- -H test.d

$ cat test.di
// D import file generated from 'test.d'
struct S
    int i;
S foo()
return (typeof(return))(123);

$ dmd -c -o- test.di
test.di(8): C style cast illegal, use cast(typeof(return))123

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to