One more cast test.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 20 Jun 2013 01:47:05 +0000 (01:47 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 20 Jun 2013 01:47:05 +0000 (01:47 +0000)
llvm-svn: 184393

clang/test/SemaTemplate/virtual-member-functions.cpp

index 6892278..439d8f8 100644 (file)
@@ -84,3 +84,15 @@ namespace PR7114 {
     xi.f();
   }
 }
+
+namespace DynamicCast {
+  struct Y {};
+  template<typename T> struct X : virtual Y {
+    virtual void foo() { T x; } // expected-error {{variable has incomplete type 'void'}}
+  };
+  template<typename T> struct X2 : virtual Y {
+    virtual void foo() { T x; }
+  };
+  Y* f(X<void>* x) { return dynamic_cast<Y*>(x); } // expected-note {{in instantiation of member function 'DynamicCast::X<void>::foo' requested here}}
+  Y* f2(X<void>* x) { return dynamic_cast<Y*>(x); }
+}