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.
          • Re: Does dm... A Guy With a Question via Digitalmars-d-learn
            • Re: Do... A Guy With a Question via Digitalmars-d-learn
              • Re... Nick Treleaven via Digitalmars-d-learn
              • Re... Steven Schveighoffer via Digitalmars-d-learn
              • Re... Steven Schveighoffer via Digitalmars-d-learn
              • Re... A Guy With a Question via Digitalmars-d-learn
              • Re... A Guy With a Question via Digitalmars-d-learn
              • Re... Atila Neves via Digitalmars-d-learn
              • Re... Steven Schveighoffer via Digitalmars-d-learn
              • Re... user1234 via Digitalmars-d-learn
          • Re: Does dm... Gary Willoughby via Digitalmars-d-learn
  • Re: Does dmd not always comp... Adam D. Ruppe via Digitalmars-d-learn

Reply via email to