-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unevaluated lambda in assert breaks gcc 7 build #705
Comments
It's odd I never experienced this error. What kind of compiler flags or Cmake options are you using? |
Nothing special. I do tend to use a bleeding edge development build of CMake but that's it. No CFLAGS, or CXX flags, etc. This is a current Fedora 26 machine with my own CMake built from cmake/master and the system gcc 7.1.1. As you can see from the verbose output, no special flags are being passed.
FWIW, I believe it's likely an issue with compiler sensitivity since I didn't get this with gcc6 when I was running Fedora 24. I can reproduce this with a dummy example by putting a lamda inside an assert and evaluating it: // foo.cxx
#include <cassert>
int main(int argc, char **argv)
{
assert([](int x) { return x == 0; }(argc));
return 0;
}
|
Isn't that a bug of GCC? I don't object to the fix, but it'd be great to report it if it's indeed a bug. |
I thought so too at first but it's not. It has to do with how int main(int argc, char **argv)
{
(void) sizeof( [] { return true; } () );
return 0;
} Which, indeed, is invalid because of the lambda expression being in the unevaluated operand of |
Wow, congrats for the impressive digging! Personally, I would not add a workaround to an already patched issue, but that is up to @nlohmann. Anyway, thanks a lot for your thorough research :) |
Thanks a lot for the research. I think merging the PR makes little sense here. If anyone encounters the same combination of problems, I think Google will send her/him here. :) |
And I also was bitten by this bug as well :) |
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 (From OE-Core rev: e80d3cb89aacc6ffb6630a106387e08483628950) Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 (From OE-Core rev: e80d3cb89aacc6ffb6630a106387e08483628950) Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 (From OE-Core rev: d9583296be58f02912abc4fd19f576b3f89107ff) Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]> (cherry picked from commit d958329) Signed-off-by: Armin Kuster <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]> (cherry picked from commit d958329) Signed-off-by: Armin Kuster <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 (From OE-Core rev: ecc789663fe83b388ecdf1b0958a2990773f7487) Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]> (cherry picked from commit d9583296be58f02912abc4fd19f576b3f89107ff) Signed-off-by: Armin Kuster <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Has this been fixed? I'm unfortunately not on bleeding edge (xtensa gcc 5.2.0), and this error popped up on line 2165 in |
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 (From OE-Core rev: d9583296be58f02912abc4fd19f576b3f89107ff) Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
* fixes "lambda-expression in unevaluated context" compile failures such as nlohmann/json#705 * fixes "no match for 'operator==" compile failures such as https://bugzilla.redhat.com/show_bug.cgi?id=1482990 (From OE-Core rev: d9583296be58f02912abc4fd19f576b3f89107ff) Signed-off-by: S. Lockwood-Childs <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
The text was updated successfully, but these errors were encountered: