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.
Comment #1 by clugdbug — 2012-06-19T00:02:54Z
Comment #2 by github-bugzilla — 2012-06-20T13:03:00Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a0976bd34fa140d574e754ff0a6ebfa7d9771d3a Fix issue 8237 Error message with _error_ when using failed type inference in template parameter https://github.com/D-Programming-Language/dmd/commit/eb414991fa87d3f701238bb5109f2d98abcb3855 Merge pull request #1016 from donc/ctfeEntry Stop running CTFE on symbols, + fix bug 8237