Does dmd not always compile all of the source code?
Gary Willoughby
dev at nomad.so
Wed Dec 6 17:20:04 UTC 2017
On Wednesday, 6 December 2017 at 16:47:17 UTC, A Guy With a
Question wrote:
> abstract class Test(T)
> {
> private:
> T thing;
>
> public:
> this(T theThing)
> {
> thing = theThing;
> thisdoesnotexist(); // expect compiler error right here!!!!
> }
> }
>
> ...but this compiles just fine.
It's because it's not being used in your program. How can the
compiler compile it without knowing what T would be?
When you do this:
> class Test2
> : Test!int
> {
> this(int thing)
> {
> super(thing);
> }
> }
You are suppling T and now it is compiled and an error raised.
More information about the Digitalmars-d-learn
mailing list