[Issue 3605] New: Compiler accepts invalid variable declaration, which does not link

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 11 02:55:10 PST 2009


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

           Summary: Compiler accepts invalid variable declaration, which
                    does not link
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: michal.minich at gmail.com


--- Comment #0 from Michal Minich <michal.minich at gmail.com> 2009-12-11 02:55:08 PST ---
1. struct, class and union type: Error 42: Symbol Undefined
_D4main4mainFZv1sMFZS4main2S2

struct S { int x; }
void main ()
{
   S s();  // braces should not be allowed.
   s.x = 1; // comment this line and example compiles and runs
}


2. int type: Error 42: Symbol Undefined _D4main4mainFZv1iMFZi

void main ()
{
    int i(); // braces should not be allowed.
    int a = i.max; // surprisingly this and next line works.
    writeln (a);
    //i = 1; // uncomment this to cause error
    //writeln (i); // or this
}


2b. this example works correctly – compiler gives some error message, even if
not so appropriate.
Error: function main.main.i () is not callable using argument types (int)
Error: expected 0 arguments, not 1 for non-variadic function type int()

void main ()
{
    int i();
    i = 1;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list