http://d.puremagic.com/issues/show_bug.cgi?id=11268
Don <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Summary|[REG 2.064beta] cannot use |Cannot use non-constant |non-constant CTFE pointer |CTFE pointer in an |in an initializer |initializer Severity|regression |normal --- Comment #5 from Don <[email protected]> 2013-10-18 00:25:23 PDT --- (In reply to comment #4) > (In reply to comment #3) > > This isn't a regression. It used to compile, but it generated wrong code. > > This also used to compile and fail the assert: > > const foo = "foo"; > const(char)* p = foo.ptr; > > void main() > { > assert(p == foo.ptr); > } > > (although I did not rely on that behavior, so for me this was a regression) The compiler was still generating wrong code. I'm downgrading this bug from regression to rejects-valid, since AFAIK there were no cases where the compiler generated correct code. Sometimes there are "regressions" where something no longer compiles that was previously wrong, but happened to work in a few special cases. But this doesn't even seem to be one of those issues. It was always wrong. > But if you change to: > > const foo = "foo"; > const(char)* p = foo; // remove .ptr > > void main() > { > assert(p == foo.ptr); > } > > It still compiles with git head, and fails the assert. Interesting. I'm not sure if that's a bug, or not. It's a slightly different case though. It's treating "foo" as a rvalue, not an lvalue. It evaluates foo, and the implicit conversion to char * happens afterwards. But with ".ptr" it _has_ to treat foo as an lvalue. while evaluating it. So the order of evaluation is different. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
