[Issue 23144] New: False circular reference error when the field name of a struct or class is the same as the type name
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 29 00:51:44 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23144
Issue ID: 23144
Summary: False circular reference error when the field name of
a struct or class is the same as the type name
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: menodinulla at gmail.com
False circular reference error occurs when the field name of a struct or class
is the same as the type name of the field.
This error doesn't occur on local variables.
---
module example;
struct S { }
struct OtherStruct
{
S s; // allowed
S S; // Error: circular reference to variable `example.OtherStruct.S`
}
class C { }
class OtherClass
{
C c; // allowed
C C; // Error: circular reference to variable `example.OtherClass.C`
}
int main()
{
S S; // allowed
C C; // allowed
return 0;
}
--
More information about the Digitalmars-d-bugs
mailing list