[Issue 14354] New: SDC test0106.d compiles, but should not

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 28 09:34:22 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14354

          Issue ID: 14354
           Summary: SDC test0106.d compiles, but should not
           Product: D
           Version: unspecified
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: shammah.chancellor at gmail.com

SDC errors:
```
> ../bin/sdc test0106.d
    int foo(int i) {
        return i;
    }
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test0106.d:13: error: Already defined
```

while DMD incorrectly compiles the source and runs.


```test0106.d
//T compiles:no
//T has-passed:yes

int main() {
    return foo();
}

int foo() {
    return 3;
}

static if(foo() == 3) {
    int foo(int i) {
        return i;
    }
}

```

--


More information about the Digitalmars-d-bugs mailing list