Bug 1814798 - pt 1. Add bool to enable/disable PHC at runtime r=glandium
[gecko.git] / build / clang-plugin / tests / TestBadImplicitConversionCtor.cpp
blobca2472582e97a6f705e00fe63f97c97823a52dac
1 #define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
3 struct Foo {
4 Foo(int); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
5 Foo(int, char=0); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
6 Foo(...); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
7 template<class T>
8 Foo(float); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
9 Foo(int, unsigned);
10 Foo(Foo&);
11 Foo(const Foo&);
12 Foo(volatile Foo&);
13 Foo(const volatile Foo&);
14 Foo(Foo&&);
15 Foo(const Foo&&);
16 Foo(volatile Foo&&);
17 Foo(const volatile Foo&&);
20 struct Bar {
21 explicit Bar(int);
22 explicit Bar(int, char=0);
23 explicit Bar(...);
26 struct Baz {
27 MOZ_IMPLICIT Baz(int);
28 MOZ_IMPLICIT Baz(int, char=0);
29 MOZ_IMPLICIT Baz(...);
32 struct Barn {
33 Barn(int) = delete;
34 Barn(int, char=0) = delete;
35 Barn(...) = delete;
38 struct Abstract {
39 Abstract(int);
40 Abstract(int, char=0);
41 Abstract(...);
42 virtual void f() = 0;
45 template<class T>
46 struct Template {
47 Template(int); // expected-error {{bad implicit conversion constructor for 'Template'}} expected-note {{consider adding the explicit keyword to the constructor}}
48 template<class U>
49 Template(float); // expected-error {{bad implicit conversion constructor for 'Template'}} expected-note {{consider adding the explicit keyword to the constructor}}