You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AFAIK, you could always use parentheses to initialize a variable, and assign to one (modulo bugs). ab29f19 added support for return.
I don't remember check((0, 0)); // BUG! ever being supported (or it was always bugged).
So the bug is either that it lowers
to a comma operator, rather than being rejected, or
to a parenthesized expression list, rather than braces for initialization.
Something that's been bothering me in Cpp2 is the overloading of parentheses.
Sometimes, it's just a primary-expression (using the comma operator).
Sometimes, it's an argument list (it's rightful use).
Sometimes, it lowers to a braced-init-list.
Instead of overloading that last meaning,
what if we just made the type-id in unnamed-declaration optional?
So we require := before the parentheses:
Another point that's been bugging me
with regards to generalized braced-init-list and
the idea that x: quantity = 0; is "explicit" (#468 (comment)).
tiles: tiles = (1); defines a container of tiles.
It has a non-implicit thisoperator= from i32.
Unfortunately, the syntax tiles: tiles = 1; also works, but tiles are NaN!
template<classT> structC {
T a;
T b;
};
autox(auto a, auto b) { return C{a, {b}}; }
autoy(auto a, auto b) { return C<decltype(a)>{a, b}; }
C v0 = x(0LL, 0);
C v1 = y(0LL, 0);
rectangle_v should have looked just like point.
But those are actually workarounds for Clang's
lack of CTAD for aliases and a bug for CTAD of prvalue aggregates.
Activity
JohelEGP commentedon Jul 14, 2023
For example, I think it's preferable to replace Cppfront's Cpp1 source code
with
respectively.
JohelEGP commentedon Jul 14, 2023
Something that's been bothering me in Cpp2 is the overloading of parentheses.
Sometimes, it's just a primary-expression (using the comma operator).
Sometimes, it's an argument list (it's rightful use).
Sometimes, it lowers to a braced-init-list.
Instead of overloading that last meaning,
what if we just made the type-id in unnamed-declaration optional?
So we require
:=before the parentheses:That could resolve #321, #449, and close #487.
#487 also mentions #408 and #451.
#408 would also be resolved.
#451 is superficially resolved, but shouldn't be closed, because as quoted:
It might seem tempting to continue permitting
v = ()by drawing parallels with #386 (comment),but
vis a variable, and not a type-id like in:v = ().JohelEGP commentedon Jul 25, 2023
Another point that's been bugging me
with regards to generalized braced-init-list and
the idea that
x: quantity = 0;is "explicit" (#468 (comment)).tiles: tiles = (1);defines a container of tiles.It has a non-
implicit thisoperator=fromi32.Unfortunately, the syntax
tiles: tiles = 1;also works, but tiles are NaN!JohelEGP commentedon Aug 2, 2023
I tried this hack: #568 (comment).
And found out that a braced-init-list argument breaks UFCS (https://cpp2.godbolt.org/z/ohz4ajMvP):
JohelEGP commentedon Sep 13, 2023
I just missed being able to make an argument be non-deducible.
I wanted
x/v0, but had to doy/v1(https://compiler-explorer.com/z/P1q6sb4dG):In my actual code base, this is the difference:
rectangle_vshould have looked just likepoint.But those are actually workarounds for Clang's
lack of CTAD for aliases and a bug for CTAD of prvalue aggregates.
JohelEGP commentedon Sep 14, 2023
Related: #568 (comment), #678, #853.
JohelEGP commentedon Oct 30, 2024
An alternative syntax is to use
_:f(_:=(17, 29)).