| Issue |
83424
|
| Summary |
Clang rejects valid program involving member access operator with incomplete type CWG 1836
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
ranaanoop
|
The following valid program as explained [here](https://stackoverflow.com/a/78080150/12002570) is rejected by clang and msvc. [Demo](https://godbolt.org/z/Yhc8MeWW6)
```
struct TestClass {
void testFinction() {}
static TestClass* ptr_;
constexpr static auto funcPtr = +[](){ ptr_->testFinction(); };
};
TestClass* TestClass::ptr_ = new TestClass();
int main() {
TestClass::funcPtr();
delete TestClass::ptr_;
return 0;
}
```
Clang says:
```
<source>:4:46: error: member access into incomplete type 'TestClass'
4 | constexpr static auto funcPtr = +[](){ ptr_->testFinction(); };
| ^
<source>:1:8: note: definition of 'TestClass' is not complete until the closing '}'
1 | struct TestClass {
| ^
1 error generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs