class X has forward references

Ali Çehreli acehreli at yahoo.com
Tue Jun 12 21:57:42 UTC 2018


On 06/12/2018 01:14 PM, bauss wrote:
 > What could cause that error?

Could be this point apparently during semantic analysis:

 
https://github.com/dlang/dmd/blob/4e35f945e3245467c7ae0abe60fc3ec896c8b45f/src/dmd/semantic2.d#L576

private extern(C++) final class Semantic2Visitor : Visitor
{
     // ...

     override void visit(AggregateDeclaration ad)
     {
         //printf("AggregateDeclaration::semantic2(%s) type = %s, errors 
= %d\n", ad.toChars(), ad.type.toChars(), ad.errors);
         if (!ad.members)
             return;

         if (ad._scope)
         {
             ad.error("has forward references");
             return;
         }

         // ...
     }
}

Does that mean that the scope pointer is already set when this 
AggregateDeclaration is being visited? If it's a bug, perhaps someone 
can think of a way of reproducing it.

Ali



More information about the Digitalmars-d-learn mailing list