[Issue 9982] ICE on CTFE for pointer dereference
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 23 07:03:09 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9982
Igor Stepanov <wazar.leollone at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wazar.leollone at yahoo.com
--- Comment #1 from Igor Stepanov <wazar.leollone at yahoo.com> 2013-04-23 07:03:08 PDT ---
I've tried to simplify this bug case.
My resolution: error in operation of taking address of struct member and
dereference it.
We must ask Don about this.
struct Foo(T)
{
T a;
this(T arg)
{
T* p = &a;
*p = arg;
}
this(T arg, int)
{
T* p = &a;
setRef(*p, arg);
}
static void setRef(ref T p, T v)
{
p = v;
}
}
auto ct1 = Foo!int(99); //compiled, but doesn't set this.a to 99
auto ct2 = Foo!int(99, 0); //compiled, but doesn't set this.a to 99
//try with struct
struct Bar
{
int b;
}
auto ct1_2 = Foo!Bar(Bar(99)); //Error
auto ct2_2 = Foo!Bar(Bar(99), 0); //ICE
void main()
{
assert(ct1.a != 99);
assert(ct2.a != 99);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list