[Issue 17235] New: Compile error inout member function, out-of-order semantic
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Feb 28 13:58:09 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17235
Issue ID: 17235
Summary: Compile error inout member function, out-of-order
semantic
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: jbc.engelen at gmail.com
This bug concerns a compilation case where compilation of one file results in
`semantic2` of a templated struct's member function, before `semantic` is
performed. The bug happens because compilation of the second file requires
`semantic` to be performed, which is exited early because `semantic2` already
ran.
The cmdline:
`dmd tracing.d defines.d`
subtyping.d(17): Error: variable subtyping.Str!().Str.foo.this inout variables
can only be declared inside inout functions
The files:
```
// File: defines.d
import subtyping;
Str!() slotsState;
```
```
// File: subtyping.d
import tracing;
int info(T)()
{
calcSize!T;
return 0;
}
struct Str()
{
alias S = Tis!int;
void foo() inout
{
}
}
struct Tis(V)
{
static someInfo = info!Tis;
V arr;
}
```
```
// File: tracing.d
import subtyping;
template retFalse(T)
{
import subtyping;
enum retFalse = false;
}
size_t staticCalcSizeSL(T)()
{
return retFalse!T;
}
void calcSize(T)()
{
enum ret = calcSizeInner!(T);
}
size_t calcSizeInner(T)()
{
foreach (fieldType; typeof(T.tupleof))
staticCalcSizeSL!fieldType;
return 1;
}
void noCallers() // somehow this is needed to reproduce the bug
{
}
```
--
More information about the Digitalmars-d-bugs
mailing list