[clang] [RFC] Initial implementation of P2719 (PR #113510)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 14 12:49:32 PDT 2025
Sterling-Augustine wrote:
Yes it does. Here is a reduced repro:
```
augustine:~/crdc $ cat repro.ii
extern void* GetMem();
class MyFileMod {
public:
MyFileMod(int x, int y) {}
void SetNext() {}
friend class Foo;
private:
static void * operator new(unsigned long size) { return GetMem(); }
static void * operator new[](unsigned long size) { return GetMem() ; }
static void * operator new(unsigned long, void *p) { return p ; }
static void * operator new[](unsigned long, void *p) { return p ; }
static void operator delete(void *p) { }
static void operator delete[](void *p) { }
static void operator delete(void*, void*) {}
static void operator delete[](void*, void*) {}
};
MyFileMod* f;
class Foo {
public:
void Bar() {
MyFileMod *new_section = new MyFileMod(0, 0) ;
new_section->SetNext() ;
}
};
augustine:~/crdc $ ~/llvm/build/bin/clang++ repro.ii -std=gnu++20 -Wuninitialized -Werror -c
repro.ii:25:13: error: variable 'new_section' is uninitialized when used here [-Werror,-Wuninitialized]
25 | new_section->SetNext() ;
| ^~~~~~~~~~~
repro.ii:24:35: note: initialize the variable 'new_section' to silence this warning
24 | MyFileMod *new_section = new MyFileMod(0, 0) ;
| ^
| = nullptr
1 error generated.
augustine:~/crdc $
```
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list