-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Ternary operator crash #1034
Copy link
Copy link
Closed
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
Activity
Metadata
Metadata
Assignees
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
This simple code crashes:
string someStr;json j = json::object();// the next line crashesj["someKey"] = someStr.empty() ? nullptr : someStr;However, if I use standard if-else condition, everything is fine:
string someStr;json j = json::object();// the code below works okif (someStr.empty()) j["someKey"] = nullptr;else j["someKey"] = someStr;Also if S is not empty - both versions work.
Is it a bug or feature? :)
I'm using GNU C++ 14 compiler, IDE Xcode 9.3