← Back to index
|
Original Bugzilla link
Bug 21576 – __traits(compile) does not automatically infer to empty parameter function template
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-01-23T18:31:43Z
Last change time
2021-01-23T20:10:20Z
Assigned to
No Owner
Creator
João Lourenço
Comments
Comment #0
by jlourenco5691 — 2021-01-23T18:31:43Z
import std; void foo(TRange ...)(TRange range) { foreach(r; range) bar(r); } void foo(TRange ...)() { foreach(T; TRange) bar!T; } void bar(T)(T t = T.init) if (!is(T == string)) {} void main() { assert(!__traits(compiles, foo(1, ""))); // ok assert(!__traits(compiles, foo!(uint, string)())); // ok assert(!__traits(compiles, foo!(uint, string))); // fails }
Comment #1
by jlourenco5691 — 2021-01-23T20:10:20Z
*** This issue has been marked as a duplicate of issue 21451 ***