An example of weird template error messaging

ag0aep6g anonymous at example.com
Sun Aug 4 21:13:02 UTC 2019


On 04.08.19 22:58, ag0aep6g wrote:
> Reduced further:
> 
> ----
> struct ObjectRefImpl1() if (is(ObjectOneImpl Super == super)) {}
> struct ObjectRefImpl2() if (is(ObjectTwoImpl Super == super)) {}
> 
> alias ObjectOne = ObjectRefImpl1!();
> 
> class ObjectOneImpl
> {
>      alias Two = ObjectRefImpl2!();
> }
> 
> class ObjectTwoImpl
> {
>      ObjectOne one; /* Error: template instance `test.ObjectRefImpl1!()` 
> is used as a type */
> }
> ----
> 
> Compilation succeeds if `ObjectOne` is moved below `ObjectOneImpl`.

And further:

----
struct ObjectRefImpl() if (is(ObjectTwoImpl Super == super)) {}

alias ObjectOne = ObjectRefImpl!();

class ObjectTwoImpl
{
     ObjectOne one; /* Error: template instance `test.ObjectRefImpl!()` 
is used as a type */
}
----


More information about the Digitalmars-d mailing list