[PATCH] D142315: [clang] Add test for CWG1111
Vlad Serebrennikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 22 11:17:52 PST 2023
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
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">Clang 6</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
@@ -1,9 +1,35 @@
-// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// 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: 6
+ // FIXME: warning is emitted for well-formed code in C++98 mode, which
+ // follows the old behavior (clang 5 and earlier). Behavior is correct in all
+ // modes, though: only candidates from the class of the object expression are
+ // considered.
+
+ template<typename>
+ struct set; // #dr1111-set-template
+
+ struct X {
+ template <typename T> void set(const T& value); // #dr1111-set-member
+ };
+ void foo() {
+ X x;
+ x.set<double>(3.2); // cxx98-error {{lookup of 'set' in member access expression is ambiguous; using member of 'X'}}
+ // cxx98-note@#dr1111-set-member {{lookup in the object type 'X' refers here}}
+ // cxx98-note@#dr1111-set-template {{lookup from the current scope refers here}}
+ }
+
+ struct Y {};
+ void bar() {
+ Y y;
+ y.set<double>(3.2); // expected-error {{no member named 'set' in 'dr1111::Y'}}
+ }
+}
+
namespace dr1113 { // dr1113: partial
namespace named {
extern int a; // expected-note {{previous}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142315.491194.patch
Type: text/x-patch
Size: 2279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230122/1d7c6d04/attachment.bin>
More information about the cfe-commits
mailing list