Bug 8237 – Error message with _error_ when using failed type inference in template parameter
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-14T02:49:00Z
Last change time
2015-06-09T05:10:40Z
Keywords
pull
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2012-06-14T02:49:29Z
template warg(R)
{
enum bool warg = false;
}
void blarg()
{
int r = void;
auto s = r ~ "xxx";
bool bbb = warg!(typeof(s));
}
bug.d(11): Error: incompatible types for ((r) ~ ("xxx")): 'int' and 'string'
bug.d(12): Error: expression warg!(_error_) is void and has no value
It shouldn't be trying to instantiate the template at all.
Another consequence of this is that CTFE can get called on a ScopeExp, which doesn't make sense (and the ScopeExp is an invalid template). This happens for example when compiling std.range with -debug -unittest.