Closed JohelEGP closed 1 year ago
Possibly related: I'm using library (flecs) with API like
ecs.system<Position, const Velocity>()
.each([] some lambda
And haven't found way to specify that const
in template call to system()
Which, I believe, cannot be deduced from parameters of lambda
foo<int>();
foo<const int>(); //error
foo<int const>(); //error
foo<in int>(); //error
Seems like a bug: https://cpp2.godbolt.org/z/Tx8e9KfKc. I suggest you open a new issue, since this one is about template parameters, not template arguments.
Ok, I do later, what I mean by related is, should I be able to put in
in <> in that case.
I don't think that can work.
In a subexpression, a parameter direction operates on an expression, not a type.
cppfront
doesn't have enough semantic information for f<in int>()
to work.
Parameter direction for template parameter is ignored.
Yes, this is by design -- I don't know what it would mean.
I should probably emit a diagnostic for it though. Thanks!
Title: Parameter direction for template parameter is ignored.
Minimal reproducer (https://cpp2.godbolt.org/z/M1jxGdeqe):
Commands:
Expected result:
For the
: type
case, a diagnostic. For the: _
case, adherence to the specified parameter direction.Actual result and error:
Cpp2 lowered to Cpp1.
```C++ #include "cpp2util.h" template