Open Quuxplusone opened 5 years ago
Bugzilla Link | PR40636 |
Status | CONFIRMED |
Importance | P enhancement |
Reported by | comex (comexk@gmail.com) |
Reported on | 2019-02-06 18:28:39 -0800 |
Last modified on | 2019-02-06 19:27:11 -0800 |
Version | trunk |
Hardware | PC All |
CC | blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
This doesn't seem to be specific to 'if constexpr'. Here's a similar bug in a
different context:
template<typename T> void f() { constexpr int n = ({T::value;}); }
incorrecly produces:
<stdin>:1:47: error: constexpr variable 'n' must be initialized by a constant
expression
template<typename T> void f() { constexpr int n = ({T::value;}); }
^ ~~~~~~~~~~~~~
<stdin>:1:51: note: non-literal type '<dependent type>' cannot be used in a
constant expression
template<typename T> void f() { constexpr int n = ({T::value;}); }
^
Looks like we fail to mark a statement-expression as value-dependent at the
right times.