[Issue 20388] Parse error when compiling lambdas in mixins as template parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 17 04:01:51 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20388
Basile-z <b2.temp at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |b2.temp at gmx.com
--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
That is indeed the PR you menton that caused the regression. The problem is
that it's hard to fix. There's a lookup that considers that the construct
'mixin' '('(<anything here with balanced L/R paren>)* ')'
(https://github.com/dlang/dmd/pull/10215/files#diff-cd066d37445cac534313c0137c2d4bbeR6935)
is always a type. In the present case the "(<anything here with balanced L/R
paren>)* is a string literal. To fix the bug the string literal should be
scanned to determine if it represents the source code for a type or not.
But even with that we can easily imagine similar cases where the string literal
is made of several symbols representing strings and that require CTFE to build
the final string to mix. Add to this the problem of out of order declarations.
Example:
---
void main() {
int a;
foo!(mixin(RetType, Body))();
}
enum RetType = "()";
enum Body = "{}";
void foo(alias t)() {
}
---
In other word I think this bug CANNOT be fixed at all.
--
More information about the Digitalmars-d-bugs
mailing list