summaryrefslogtreecommitdiffstats
path: root/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp')
-rw-r--r--build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp b/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp
new file mode 100644
index 0000000000..ca2472582e
--- /dev/null
+++ b/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp
@@ -0,0 +1,50 @@
+#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
+
+struct Foo {
+ Foo(int); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ Foo(int, char=0); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ Foo(...); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ template<class T>
+ Foo(float); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ Foo(int, unsigned);
+ Foo(Foo&);
+ Foo(const Foo&);
+ Foo(volatile Foo&);
+ Foo(const volatile Foo&);
+ Foo(Foo&&);
+ Foo(const Foo&&);
+ Foo(volatile Foo&&);
+ Foo(const volatile Foo&&);
+};
+
+struct Bar {
+ explicit Bar(int);
+ explicit Bar(int, char=0);
+ explicit Bar(...);
+};
+
+struct Baz {
+ MOZ_IMPLICIT Baz(int);
+ MOZ_IMPLICIT Baz(int, char=0);
+ MOZ_IMPLICIT Baz(...);
+};
+
+struct Barn {
+ Barn(int) = delete;
+ Barn(int, char=0) = delete;
+ Barn(...) = delete;
+};
+
+struct Abstract {
+ Abstract(int);
+ Abstract(int, char=0);
+ Abstract(...);
+ virtual void f() = 0;
+};
+
+template<class T>
+struct Template {
+ Template(int); // expected-error {{bad implicit conversion constructor for 'Template'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ template<class U>
+ Template(float); // expected-error {{bad implicit conversion constructor for 'Template'}} expected-note {{consider adding the explicit keyword to the constructor}}
+};