On 08/27/2012 10:48 AM, Piotr Duda wrote:
2012/8/27 Walter Bright <newshou...@digitalmars.com>:
On 8/26/2012 11:14 PM, Piotr Duda wrote:

Default args should be part of types (for passing them as template
args etc, implicity convertable if they differs only on defaults) but
not mangled in (since mangling is revelant only for linking, where
defaults doesn't matter).


And then there's a list of other bugs that show up. Now you have two
different types showing up as the same type (i.e. name) to the linker, and
you've got weird collisions.

For linker these types should be identical, so there shouldn't be any
collisions, unless D handles default args fundamentally different than
C++.


You said they should be part of the type for passing as template args:

auto foo(T)(T dg){
    return dg();
}

// therefore
assert(foo((int x=2)=>x)==2); // this instantiation
assert(foo((int x=3)=>x)==3); // must differ from this one
// ergo, they cannot have the same mangled symbol name!

Reply via email to