erichkeane added a comment. Agreed. For other reviewers, note that this is the compelling example:
template<typename T> static constexpr bool VarTempl = true; template<typename T> int func() { if constexpr (VarTempl<T>) return 1; static_assert(!VarTempl<T>); } void use() { func<int>(); } The static-assert would fail, since it isn't a discarded statement. template<typename T> static constexpr bool VarTempl = true; template<typename T> int func() { if constexpr (VarTempl<T>) return 1; else static_assert(!VarTempl<T>); } void use() { func<int>(); } But in THIS case the static-assert is discarded. That is, the 'else' in a if-constexpr isn't required to be anything other than lexically valid, so dependent lookup doesn't need to happen, instantiations aren't required, etc. Therefore there is EXTREME value to having an 'else' there after a return. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132232/new/ https://reviews.llvm.org/D132232 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits