summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/FixIt/fixit.cpp7
-rw-r--r--clang/test/Parser/cxx-class.cpp14
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit.cpp b/clang/test/FixIt/fixit.cpp
index f2649385656..6c328c52180 100644
--- a/clang/test/FixIt/fixit.cpp
+++ b/clang/test/FixIt/fixit.cpp
@@ -308,6 +308,13 @@ namespace dtor_fixit {
~bar() { } // expected-error {{expected the class name after '~' to name a destructor}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:6-[[@LINE-1]]:9}:"foo"
};
+
+ class bar {
+ ~bar();
+ };
+ ~bar::bar() {} // expected-error {{'~' in destructor name should be after nested name specifier}}
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:4}:""
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:9-[[@LINE-2]]:9}:"~"
}
namespace PR5066 {
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
index 69776f4d422..7e820f17aad 100644
--- a/clang/test/Parser/cxx-class.cpp
+++ b/clang/test/Parser/cxx-class.cpp
@@ -139,6 +139,20 @@ namespace CtorErrors {
};
}
+namespace DtorErrors {
+ struct A { ~A(); } a;
+ ~A::A() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-note {{previous}}
+ A::~A() {} // expected-error {{redefinition}}
+
+ struct B { ~B(); } *b;
+ DtorErrors::~B::B() {} // expected-error {{'~' in destructor name should be after nested name specifier}}
+
+ void f() {
+ a.~A::A(); // expected-error {{'~' in destructor name should be after nested name specifier}}
+ b->~DtorErrors::~B::B(); // expected-error {{'~' in destructor name should be after nested name specifier}}
+ }
+}
+
namespace BadFriend {
struct A {
friend int : 3; // expected-error {{friends can only be classes or functions}}
OpenPOWER on IntegriCloud