[clang] [clang][NFC] Add test for CWG1898 "Use of “equivalent” in overload resolution" (PR #113439)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 23 05:06:06 PDT 2024
================
@@ -640,3 +640,48 @@ namespace H {
struct S s;
}
}
+
+namespace cwg1898 { // cwg1898: 2.7
+void e(int) {} // #cwg1898-e-int
+void e(int) {}
+// expected-error at -1 {{redefinition of 'e'}}
+// expected-note@#cwg1898-e-int {{previous definition is here}}
+void e(long) {}
+
+void f(int) {} // #cwg1898-f-int
+void f(const int) {}
+// expected-error at -1 {{redefinition of 'f'}}
+// expected-note@#cwg1898-f-int {{previous definition is here}}
+
+void g(int) {} // #cwg1898-g-int
+void g(volatile int) {}
+// since-cxx20-warning at -1 {{volatile-qualified parameter type 'volatile int' is deprecated}}
+// expected-error at -2 {{redefinition of 'g'}}
+// expected-note@#cwg1898-g-int {{previous definition is here}}
+
+void h(int *) {} // #cwg1898-h-int
+void h(int[]) {}
+// expected-error at -1 {{redefinition of 'h'}}
+// expected-note@#cwg1898-h-int {{previous definition is here}}
+
+void i(int *) {} // #cwg1898-i-int
+void i(int[2]) {}
+// expected-error at -1 {{redefinition of 'i'}}
+// expected-note@#cwg1898-i-int {{previous definition is here}}
+
+void j(void(*)()) {} // #cwg1898-j-int
+void j(void()) {}
+// expected-error at -1 {{redefinition of 'j'}}
+// expected-note@#cwg1898-j-int {{previous definition is here}}
+
+struct A {
+ void k(int) {} // #cwg1898-k-int
+ void k(int) {}
+ // expected-error at -1 {{class member cannot be redeclared}}
+ // expected-note@#cwg1898-k-int {{previous definition is here}}
+};
+
+struct B : A {
+ void k(int) {}
+};
+} // namespace cwg1898
----------------
cor3ntin wrote:
you could add all the examples there as-is https://eel.is/c++draft/dcl.dcl#dcl.fct-example-2
```cpp
void g(...);
void g();
```
There are a lot of tests with explicit object parameters but I don't think we need to cover them here, there are plenty of such tests already, and the issue predates deducing this
https://github.com/llvm/llvm-project/pull/113439
More information about the cfe-commits
mailing list