[Issue 1528] [tdpl] overloading template and non-template functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 25 12:19:31 PDT 2012


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



--- Comment #8 from Simen Kjaeraas <simen.kjaras at gmail.com> 2012-08-25 12:19:25 PDT ---
(In reply to comment #7)
> > This bug causes problems with @disabled default constructors.
> 
> From what I can tell, @disable this() doesn't work _at all_: bug# 7021

@disable this() does work in some cases:

struct Foo {
    @disable this( );
}

struct Bar {
    Foo f;
    this( int n ) {
        // Error: constructor Bar.this field f must be initialized in
constructor
    }
}

void main( ) {
    Foo f; // Error: variable main.d initializer required for type Foo
}

However, if you need a templated constructor, this goes out the window, for the
reasons outlined above.


> I don't think that this bug has anything to do with it.

Yes and no. The problems of @disable this are exacerbated by this bug.


> And I wouldn't expect @disable this()(); to work anyway, because the function
> that you're trying to disable doesn't exist. It would have to be instantiatied
> to exist, and it's not possible to call a default constructor on a struct,
> since they're not legal in the first place, so it can't be instantiated.
> @disable this()(); should probably result in an error.

Nor would I, but when faced with the error that templated and non-templated
functions cannot form an overload set together, that is the logical thing to
try, and it doesn't work either.

-- 
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