summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/undefined-internal.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-02-25 08:52:25 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-02-25 08:52:25 +0000
commita28097da4fbae525909886f348046e24248fd4c0 (patch)
treec44e87ae78df72e914313f73e775be029992f873 /clang/test/SemaCXX/undefined-internal.cpp
parentaa06169f7c6b838ed93bfb2e227f31c5605bab95 (diff)
downloadbcm5719-llvm-a28097da4fbae525909886f348046e24248fd4c0.tar.gz
bcm5719-llvm-a28097da4fbae525909886f348046e24248fd4c0.zip
Rough fix for PR9323 that prevents Clang from marking copy constructor
declarations as referenced when in fact we're not going to even form a call in the AST. This is significant because we attempt to allow as an extension classes with intentionally private and undefined copy constructors to have temporaries bound to references, and so shouldn't warn about the lack of definition for that copy constructor when the class is internal. Doug, John wasn't really satisfied with the presence of overloading at all. This is a stop-gap and there may be a better solution. If you can give me some hints for how you'd prefer to see this solved, I'll happily switch things over. llvm-svn: 126480
Diffstat (limited to 'clang/test/SemaCXX/undefined-internal.cpp')
-rw-r--r--clang/test/SemaCXX/undefined-internal.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/undefined-internal.cpp b/clang/test/SemaCXX/undefined-internal.cpp
index a7e92499657..e926f18d5ff 100644
--- a/clang/test/SemaCXX/undefined-internal.cpp
+++ b/clang/test/SemaCXX/undefined-internal.cpp
@@ -105,3 +105,20 @@ namespace test6 {
a.value = A<Internal>::two;
}
}
+
+// We support (as an extension) private, undefined copy constructors when
+// a temporary is bound to a reference even in C++98. Similarly, we shouldn't
+// warn about this copy constructor being used without a definition.
+namespace PR9323 {
+ namespace {
+ struct Uncopyable {
+ Uncopyable() {}
+ private:
+ Uncopyable(const Uncopyable&); // expected-note {{declared private here}}
+ };
+ }
+ void f(const Uncopyable&) {}
+ void test() {
+ f(Uncopyable()); // expected-warning {{C++98 requires an accessible copy constructor}}
+ };
+}
OpenPOWER on IntegriCloud