Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators.
Add custom conversions to static_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77076 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp
index d99f3e5..d9088c8 100644
--- a/test/SemaTemplate/instantiate-cast.cpp
+++ b/test/SemaTemplate/instantiate-cast.cpp
@@ -1,6 +1,6 @@
// RUN: clang-cc -fsyntax-only -verify %s
-struct A { int x; };
+struct A { int x; }; // expected-note 2 {{candidate}}
class Base {
public:
@@ -23,7 +23,7 @@
template<typename T, typename U>
struct CStyleCast0 {
void f(T t) {
- (void)((U)t); // FIXME:ugly expected-error{{operand}}
+ (void)((U)t); // expected-error{{C-style cast from 'struct A' to 'int'}}
}
};
@@ -36,7 +36,7 @@
template<typename T, typename U>
struct StaticCast0 {
void f(T t) {
- (void)static_cast<U>(t); // expected-error{{static_cast}}
+ (void)static_cast<U>(t); // expected-error{{initialization of 'struct A'}}
}
};
@@ -89,7 +89,7 @@
template<typename T, typename U>
struct FunctionalCast1 {
void f(T t) {
- (void)U(t); // FIXME:ugly expected-error{{operand}}
+ (void)U(t); // expected-error{{C-style cast from 'struct A' to 'int'}}
}
};