May 14, 2013 [Issue 10080] New: Attributes lost when passing value to a templated function | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10080 Summary: Attributes lost when passing value to a templated function Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: simendsjo@gmail.com --- Comment #0 from simendsjo <simendsjo@gmail.com> 2013-05-14 00:34:37 PDT --- 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? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 14, 2013 [Issue 10080] Attributes lost when passing value to a templated function | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | http://d.puremagic.com/issues/show_bug.cgi?id=10080 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #1 from Kenji Hara <k.hara.pg@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: ------- |
Copyright © 1999-2021 by the D Language Foundation