[Issue 21288] New: Wrong context pointer for alias this function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 1 08:33:47 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21288
Issue ID: 21288
Summary: Wrong context pointer for alias this function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: rmanth at gmail.com
struct A
{
int p;
}
struct B
{
A a() { return A.init; }
alias a this;
}
struct C
{
void foo()
{
static assert(B.p.stringof == "p"); // Error: this for s needs to be
type B not type C
}
}
void foo()
{
static assert(B.p.stringof == "p"); // totally fine
}
--
More information about the Digitalmars-d-bugs
mailing list