Open Quuxplusone opened 3 years ago
Bugzilla Link | PR48839 |
Status | CONFIRMED |
Importance | P normal |
Reported by | Mital Ashok (mital.vaja@googlemail.com) |
Reported on | 2021-01-21 14:57:01 -0800 |
Last modified on | 2021-06-25 03:16:21 -0700 |
Version | trunk |
Hardware | All All |
CC | blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, futogergely@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
From the diagnostics:
... it looks like we're creating a duplicate local struct d
within the d::d(int)
constructor (and so on, recursively).
This appears to have regressed between Clang 3.3 and 3.4.
Hi, I'm new to clang, but do you mind if I start working on this? Thanks, Gergely
Different issue, but this should also work right?
template<typename T>
void construct() {
constexpr T t(0);
}
template<typename T>
void tester() {
struct d {
void test() {
construct<d>();
}
constexpr d(T b) : a(b) {}
T a;
};
}
int main() {
tester<int>();
}
clang fails with following error:
<source>:3:17: error: constexpr variable 't' must be initialized by a constant
expression
constexpr T t(0);
^~~~
link: https://godbolt.org/z/93ecvjE5h