The following code doesn't compile:
struct S
{
this(T...)(T args)
{
}
}
Comment #1 by 2korden — 2009-01-21T01:19:40Z
S s = S();
What should be called - a default ctor or S.this() with empty tuple?
Comment #2 by andrei — 2009-01-21T09:13:54Z
(In reply to comment #1)
> S s = S();
>
> What should be called - a default ctor or S.this() with empty tuple?
>
Good question. Today that must be the default ctor because any struct must have a default constructor that doesn't execute user code.
Comment #3 by smjg — 2009-01-22T19:49:34Z
(In reply to comment #1)
> S s = S();
>
> What should be called - a default ctor or S.this() with empty tuple?
The two would be one and the same.
Comment #4 by bugzilla — 2009-03-16T18:44:46Z
It isn't variadic constructors, it's any constructor templates.
Comment #5 by jarrett.billingsley — 2009-03-16T18:56:09Z
(In reply to comment #4)
> It isn't variadic constructors, it's any constructor templates.
>
Why? Ctors are not virtual; why can't they be templated?
Comment #6 by 2korden — 2009-03-16T19:07:32Z
(In reply to comment #5)
> (In reply to comment #4)
> > It isn't variadic constructors, it's any constructor templates.
> >
>
> Why? Ctors are not virtual; why can't they be templated?
>
Walter didn't say it is impossible, he merely pointed out that the case is not a variadic constructor, but a /variadic template/ constructor, I believe.
Comment #7 by jarrett.billingsley — 2009-03-16T19:48:23Z
>
> Walter didn't say it is impossible, he merely pointed out that the case is not
> a variadic constructor, but a /variadic template/ constructor, I believe.
>
I didn't say that he said that it was impossible ;) I asked "why can't ctors be templated" as in "why is it not possible now" instead of "why is it not possible".
Comment #8 by 2korden — 2009-03-16T19:59:55Z
(In reply to comment #7)
> >
> > Walter didn't say it is impossible, he merely pointed out that the case is not
> > a variadic constructor, but a /variadic template/ constructor, I believe.
> >
>
> I didn't say that he said that it was impossible ;) I asked "why can't ctors
> be templated" as in "why is it not possible now" instead of "why is it not
> possible".
>
Well, ahem... It's a bug (or rather a missing functionality), that's why this report is here :)
Comment #9 by jarrett.billingsley — 2009-03-16T20:46:19Z
(In reply to comment #8)
>
> Well, ahem... It's a bug (or rather a missing functionality), that's why this
> report is here :)
>
Sure, and I'm just trying to provoke conversation about the issue with the language designer.
Comment #10 by bugzilla — 2009-04-01T13:52:50Z
Fixed DMD 2.027
Comment #11 by dlang-bot — 2023-08-12T17:44:51Z
dlang/dlang.org pull request #3602 "Updates to Template Comparison page" was merged into master:
- 00028f506c024b3b08c96666bd2e6fdcfa000fb0 by tjs137:
Constructor templates are supported since 2.027
See resolved Bugzilla issue 2596.
https://github.com/dlang/dlang.org/pull/3602