зеркало из https://github.com/microsoft/clang-1.git
Add test for C++ DR899.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151411 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
3cd89ad193
Коммит
9b42afdccc
|
@ -13,3 +13,25 @@ namespace ExplicitConv {
|
|||
X x3 = y; // expected-error{{no viable conversion from 'const ExplicitConv::Y' to 'ExplicitConv::X'}}
|
||||
}
|
||||
}
|
||||
|
||||
namespace DR899 {
|
||||
struct C { }; // expected-note 2 {{candidate constructor}}
|
||||
|
||||
struct A {
|
||||
explicit operator int() const;
|
||||
explicit operator C() const;
|
||||
};
|
||||
|
||||
struct B {
|
||||
int i;
|
||||
B(const A& a): i(a) { }
|
||||
};
|
||||
|
||||
int main() {
|
||||
A a;
|
||||
int i = a; // expected-error{{no viable conversion}}
|
||||
int j(a);
|
||||
C c = a; // expected-error{{no viable conversion}}
|
||||
C c2(a);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче