diff options
Diffstat (limited to 'clang/test/SemaCXX/warn-global-constructors.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-global-constructors.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-global-constructors.cpp b/clang/test/SemaCXX/warn-global-constructors.cpp index a9347ea3001..107bbe129f6 100644 --- a/clang/test/SemaCXX/warn-global-constructors.cpp +++ b/clang/test/SemaCXX/warn-global-constructors.cpp @@ -56,3 +56,26 @@ namespace test4 { char b[5] = "hello"; char c[][5] = { "hello" }; } + +namespace test5 { + struct A { A(); }; + + void f1() { + static A a; + } + void f2() { + static A& a = *new A; + } +} + +namespace test6 { + struct A { ~A(); }; + + void f1() { + static A a; // expected-warning {{global destructor}} + } + void f2() { + static A& a = *new A; + } + +}
\ No newline at end of file |