[PATCH] D142315: [clang] Add test for CWG1111
Vlad Serebrennikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 26 04:54:53 PST 2023
Endill updated this revision to Diff 492395.
Endill added a comment.
Change status from "6" to "yes" since "ambiguous-member-template" warning is a false-positive now.
- Disable "ambiguous-member-template" diagnostic in 98 and 03 modes
- Add an example (`struct A`)
- Apply clang-format
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142315/new/
https://reviews.llvm.org/D142315
Files:
clang/test/CXX/drs/dr11xx.cpp
clang/www/cxx_dr_status.html
Index: clang/www/cxx_dr_status.html
===================================================================
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -6473,7 +6473,7 @@
<td><a href="https://wg21.link/cwg1111">1111</a></td>
<td>C++11</td>
<td>Remove dual-scope lookup of member template names</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="1112">
<td><a href="https://wg21.link/cwg1112">1112</a></td>
Index: clang/test/CXX/drs/dr11xx.cpp
===================================================================
--- clang/test/CXX/drs/dr11xx.cpp
+++ clang/test/CXX/drs/dr11xx.cpp
@@ -4,6 +4,46 @@
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+namespace dr1111 { // dr1111: yes
+namespace example1 {
+template <typename> struct set;
+
+struct X {
+ template <typename T> void set(const T &value);
+};
+void foo() {
+ X x;
+#pragma clang diagnostic push
+#if __cplusplus < 201103L
+#pragma clang diagnostic ignored "-Wambiguous-member-template"
+#endif
+ x.set<double>(3.2);
+#pragma clang diagnostic pop
+}
+
+struct Y {};
+void bar() {
+ Y y;
+ y.set<double>(3.2); // expected-error {{no member named 'set' in 'dr1111::example1::Y'}}
+}
+} // namespace example1
+
+namespace example2 {
+struct A {};
+namespace N {
+struct A {
+ void g() {}
+ template <class T> operator T();
+};
+} // namespace N
+
+void baz() {
+ N::A a;
+ a.operator A();
+}
+} // namespace example2
+} // namespace dr1111
+
namespace dr1113 { // dr1113: partial
namespace named {
extern int a; // expected-note {{previous}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142315.492395.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230126/0f3614e3/attachment.bin>
More information about the cfe-commits
mailing list