Bug 11195 – Error messages not suppressed in __traits(compiles,...) for template instantiation nested in aggregate

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-08T05:10:00Z
Last change time
2017-06-28T09:26:13Z
Assigned to
nobody
Creator
simen.kjaras

Comments

Comment #0 by simen.kjaras — 2013-10-08T05:10:15Z
import std.traits : ParameterTypeTuple; void foo()() {} void main() { assert(!__traits(compiles, {struct A{ParameterTypeTuple!foo tmp;}})); } The above program fails to compile with this message: bug.d(6): Error: template instance ParameterTypeTuple!(foo) does not match template declaration ParameterTypeTuple(func...) if (func.length == 1 && isCallable!func) Replace ParameterTypeTuple!foo with a simple type, and things work wonderfully.
Comment #1 by andrej.mitrovich — 2013-10-08T05:44:10Z
Same issue with is(typeof()) as well.
Comment #2 by simen.kjaras — 2013-10-08T08:35:33Z
True, I forgot mentioning that. Simplified example: template bar(T...) { alias bar = void; } void foo()() {} void main() { assert(!__traits(compiles, {struct A{bar!foo tmp;}})); assert(!is(typeof({struct A{bar!foo tmp;}}))); } Also worth noting that these work (note the lack of a surrounding struct): assert(!__traits(compiles, {bar!foo tmp;})); assert(!is(typeof({bar!foo tmp;}))); I updated the summary to reflect this.
Comment #3 by simen.kjaras — 2017-06-28T08:37:18Z
This has apparently been solved some time in the last 4 years.
Comment #4 by dlang-bugzilla — 2017-06-28T09:26:13Z
(In reply to Simen Kjaeraas from comment #3) > This has apparently been solved some time in the last 4 years. Fixed in 2.066.0 by https://github.com/dlang/dmd/pull/3514 *** This issue has been marked as a duplicate of issue 12555 ***