Hacker News new | ask | show | jobs
by jenadine 1119 days ago
Disaster? Just because it introduces a scope? Please elaborate. A scope is the right thing to do, every other {} introduce a scope, so if this wouldn't have been consistent with the normal 'if' that would have been extra confusing.

Maybe you'd like to do something like:

    template<typename T>
    struct ABC {
       int x;
       int y;
       if constexpr (is_3d<T>) {
          int z;
        }
     };
But yeah, that's not what if constexpr does.
2 comments

That’s exactly what it could have allowed, and become a much more powerful construct in the language
Which is why it's crap => back to macros we go.