public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/112291] New: cyclic reference struct with `in` parameter and `-fpreview=in` causes bogus error: overlapping initializer for field ...
@ 2023-10-30 12:51 gcc.gnu.org at webfreak dot org
0 siblings, 0 replies; only message in thread
From: gcc.gnu.org at webfreak dot org @ 2023-10-30 12:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112291
Bug ID: 112291
Summary: cyclic reference struct with `in` parameter and
`-fpreview=in` causes bogus error: overlapping
initializer for field ...
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: gcc.gnu.org at webfreak dot org
Target Milestone: ---
minimal reproduction case:
```
// dependency.d
module dependency;
import package_;
struct PackageDependency {
Dependency spec;
int anythingEitherBeforeOrAfter;
}
struct Dependency {
}
void getTopologicalPackageList(in Package)
{
}
```
```
// package_.d
module package_;
import dependency;
class Package {
PackageDependency getAllDependencies()
{
return PackageDependency.init;
}
}
```
CLI:
```
gdc -fpreview=in -I. dependency.d
```
causing:
```
dependency.d:5:1: error: overlapping initializer for field
‘PackageDependency’.‘anythingEitherBeforeOrAfter’
5 | struct PackageDependency {
| ^
```
compiling both dependency.d and package_.d in the same CLI causes multiple
errors:
```
dependency.d:5:1: error: overlapping initializer for field
‘PackageDependency’.‘anythingEitherBeforeOrAfter’
5 | struct PackageDependency {
| ^
package_.d: In function ‘getAllDependencies’:
package_.d:8:24: error: overlapping initializer for field
‘PackageDependency’.‘anythingEitherBeforeOrAfter’
8 | return PackageDependency.init;
| ^
```
compiling only package_.d alone does not cause any errors.
removing `anythingEitherBeforeOrAfter` makes the error go away
copying package_.d into dependency.d (flattening the import) also makes the
error go away
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-30 12:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 12:51 [Bug d/112291] New: cyclic reference struct with `in` parameter and `-fpreview=in` causes bogus error: overlapping initializer for field gcc.gnu.org at webfreak dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).