https://d.puremagic.com/issues/show_bug.cgi?id=11857
--- Comment #4 from Kenji Hara <[email protected]> 2014-01-13 01:09:04 PST --- (In reply to comment #3) > So do I understand correctly ICE part of the issue is considered a duplicate > of > issue 11822 and "This code should compile" part is considered WONTFIX? If so, > where is the documentation claiming such code incorrect? In short, yes. Even `const int n = 1` is interpreted in compile time, `n` is a local variable that has runtime storage on stack. Therefore, expression `n` makes lvalue, then preferentially matches to `out` parameter. This behavior is intended to reduce confusion at the situation that mixing constant-folding and compile-time/runtime evaluation. Example: void f( immutable int n); void f(ref immutable int n); // accepts only lvalue void foo(int x) { immutable int n = x; // n is evaluated in runtime (when foo is called) f(n); // n matches to ref version } void bar(int x) { immutable int n = 1; // n can be interpreted at compile time, // but still allocated on stack and initialized in runtime. f(n); // n still matches to ref version } D is designed to provide consistent overload resolution result for f(n) in both foo and bar. In other words, variable evaluation and its ref-ness is strictly separated from the CTFE/constant-folding. Conflating them would make hard to understand overload resolution result. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
