summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-09-10 22:05:41 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-09-10 22:05:41 +0000
commit6154ef97a375ae4bc276c43adad57c4f9f850b90 (patch)
treee10b5248c130bb8134b1c9ff31fd2bb5b14aa679 /clang/test
parent8c72306cdb6713750da6427f177323f4abf4eca9 (diff)
downloadbcm5719-llvm-6154ef97a375ae4bc276c43adad57c4f9f850b90.tar.gz
bcm5719-llvm-6154ef97a375ae4bc276c43adad57c4f9f850b90.zip
Fix PR13784: instantiation of an abstract class in a conditional operator.
A couple of missing "RequireNonAbstractType" calls in conditional operator handling. I looked for opportunities to tie this check in to all relevant callers of PerformCopyInitialization (couldn't be all callers since this is called for base subobject copying too, where it's acceptable to copy abstract types) but the callers varied too much & in many cases had substantial code or conditionals on the RequireNonAbstractType call, the PerformCopyInitialization call, or the code between the two calls. llvm-svn: 163555
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/conditional-expr.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp
index a80eda416f4..7595f1dfa1c 100644
--- a/clang/test/SemaCXX/conditional-expr.cpp
+++ b/clang/test/SemaCXX/conditional-expr.cpp
@@ -57,6 +57,16 @@ struct Ambig {
operator signed char(); // expected-note 2 {{candidate function}}
};
+struct Abstract {
+ virtual ~Abstract() = 0; // expected-note {{unimplemented pure virtual method '~Abstract' in 'Abstract'}}
+};
+
+struct Derived1: Abstract {
+};
+
+struct Derived2: Abstract {
+};
+
void test()
{
// This function tests C++0x 5.16
@@ -206,6 +216,9 @@ void test()
// Note the thing that this does not test: since DR446, various situations
// *must* create a separate temporary copy of class objects. This can only
// be properly tested at runtime, though.
+
+ const Abstract &a = true ? static_cast<const Abstract&>(Derived1()) : Derived2(); // expected-error {{allocating an object of abstract class type 'const Abstract'}}
+ true ? static_cast<const Abstract&>(Derived1()) : throw 3; // expected-error {{allocating an object of abstract class type 'const Abstract'}}
}
namespace PR6595 {
OpenPOWER on IntegriCloud