[Issue 23152] New: Bad diagnostic for variable used as a type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 1 11:44:24 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23152
Issue ID: 23152
Summary: Bad diagnostic for variable used as a type
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
The error for
```
struct S1 {}
struct S2 { S1 S1; }
```
is
> a7F65CC3F01F0.d:2:16: Error: circular reference to variable `a7F65CC3F01F0.S2.S1`
I believe the right error should be
> a7F65CC3F01F0.d:2:16: Error: variable `a7F65CC3F01F0.S2.S1` is used as a type
A quick verification on run.dlang.io shows that this was the case in the past:
---
Up to 2.062 : Failure with output: Error: unrecognized switch '-main'
2.063 to 2.064 : Failure with output:
-----
onlineapp.d(2): Error: circular reference to 'onlineapp.S2.S1'
onlineapp.d(2): Error: S1 is used as a type
-----
2.065.0: Failure with output: onlineapp.d(2): Error: circular
reference to 'onlineapp.S2.S1'
2.066.1 to 2.071.2: Failure with output:
-----
onlineapp.d(2): Error: circular reference to 'onlineapp.S2.S1'
onlineapp.d(2): Error: S1 is used as a type
-----
2.072.2 to 2.078.3: Failure with output: onlineapp.d(2): Error: circular
reference to variable 'onlineapp.S2.S1'
Since 2.079.1: Failure with output: onlineapp.d(2): Error: circular
reference to variable `onlineapp.S2.S1`
---
but since 2.072.2 among the two messages only the less relevant is output
--
More information about the Digitalmars-d-bugs
mailing list