According to the proposal, I guess.
I'd expect the test cases to check whether the expression's type has those qualifiers.
x is const _ would be a nice way of asking "is xconst?"
Actual result and error:
true;
true;
true;
true;
true;
true;
Cpp2 lowered to Cpp1.
```C++
#include "cpp2util.h"
auto main() -> int;
auto main() -> int{
auto x {0};
true;
true;
true;
true;
true;
true;
}
```
Warnings.
```output
build/_cppfront/main.cpp:9:8: warning: unused variable 'x' [-Wunused-variable]
auto x {0};
^
build/_cppfront/main.cpp:10:3: warning: expression result unused [-Wunused-value]
true;
^~~~
build/_cppfront/main.cpp:11:3: warning: expression result unused [-Wunused-value]
true;
^~~~
build/_cppfront/main.cpp:12:3: warning: expression result unused [-Wunused-value]
true;
^~~~
build/_cppfront/main.cpp:13:3: warning: expression result unused [-Wunused-value]
true;
^~~~
build/_cppfront/main.cpp:14:3: warning: expression result unused [-Wunused-value]
true;
^~~~
build/_cppfront/main.cpp:15:3: warning: expression result unused [-Wunused-value]
true;
^~~~
7 warnings generated.
Program returned: 0
```
Other observations:
I think it's reasonable for even x is _ to not be unconditionally true
for template metaprogramming purposes where non-dependent true would be a hard error.
Title:
is * const _
unconditionallytrue
.Minimal reproducer (https://cpp2.godbolt.org/z/1TT333zb6):
Commands:
Expected result:
According to the proposal, I guess. I'd expect the test cases to check whether the expression's type has those qualifiers.
x is const _
would be a nice way of asking "isx
const
?"Actual result and error:
Cpp2 lowered to Cpp1.
```C++ #include "cpp2util.h" auto main() -> int; auto main() -> int{ auto x {0}; true; true; true; true; true; true; } ```Warnings.
```output build/_cppfront/main.cpp:9:8: warning: unused variable 'x' [-Wunused-variable] auto x {0}; ^ build/_cppfront/main.cpp:10:3: warning: expression result unused [-Wunused-value] true; ^~~~ build/_cppfront/main.cpp:11:3: warning: expression result unused [-Wunused-value] true; ^~~~ build/_cppfront/main.cpp:12:3: warning: expression result unused [-Wunused-value] true; ^~~~ build/_cppfront/main.cpp:13:3: warning: expression result unused [-Wunused-value] true; ^~~~ build/_cppfront/main.cpp:14:3: warning: expression result unused [-Wunused-value] true; ^~~~ build/_cppfront/main.cpp:15:3: warning: expression result unused [-Wunused-value] true; ^~~~ 7 warnings generated. Program returned: 0 ```Other observations:
I think it's reasonable for even
x is _
to not be unconditionallytrue
for template metaprogramming purposes where non-dependenttrue
would be a hard error.