[Issue 10080] Attributes lost when passing value to a templated function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 14 00:48:06 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10080
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2013-05-14 00:48:06 PDT ---
(In reply to comment #0)
> Using dmd 2.062 on GNU/Linux, this prints:
> main: tuple(1)
> f: tuple()
> g: tuple(1)
>
> void f(T)(T o) {
> pragma(msg, "f: ", __traits(getAttributes, o));
> }
>
> void g(alias T)() {
> pragma(msg, "g: ", __traits(getAttributes, T));
> }
>
> void main() {
> @(1) int i;
> pragma(msg, "main: ", __traits(getAttributes, i));
> f(i);
> g!i;
> }
>
> Is this intended behavior?
It's intended behavior, because UDA is always associated with symbols.
In template function f, `o` is a function parameter, and it is different symbol
from the local variable i in main function.
--
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