[clang] 80bae9a - [clang] Add test for CWG405
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 6 01:35:28 PST 2022
Author: Vlad Serebrennikov
Date: 2022-12-06T12:35:21+03:00
New Revision: 80bae9aacc1452d18bfb1fe7437f5dcd160614d3
URL: https://github.com/llvm/llvm-project/commit/80bae9aacc1452d18bfb1fe7437f5dcd160614d3
DIFF: https://github.com/llvm/llvm-project/commit/80bae9aacc1452d18bfb1fe7437f5dcd160614d3.diff
LOG: [clang] Add test for CWG405
P1787: //CWG405 is resolved by stating that argument-dependent lookup (sometimes) occurs after an ordinary unqualified lookup (making statements like “finding a variable prevents argument-dependent lookup” formally correct).//
Wording: see changes to [basic.lookup.argdep] p1 and p3
This issue seems a duplicate of CWG218, even though it is not officially recognized. A part of a test for CWG218 is reused here, adding cross-references.
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D139095
Added:
Modified:
clang/test/CXX/drs/dr2xx.cpp
clang/test/CXX/drs/dr4xx.cpp
clang/www/cxx_dr_status.html
Removed:
################################################################################
diff --git a/clang/test/CXX/drs/dr2xx.cpp b/clang/test/CXX/drs/dr2xx.cpp
index c76b65ddeef56..31ac31b088105 100644
--- a/clang/test/CXX/drs/dr2xx.cpp
+++ b/clang/test/CXX/drs/dr2xx.cpp
@@ -141,6 +141,7 @@ namespace dr217 { // dr217: yes
}
namespace dr218 { // dr218: yes
+ // NB: also dup 405
namespace A {
struct S {};
void f(S);
diff --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp
index 4e437b272087b..1814f5ac32185 100644
--- a/clang/test/CXX/drs/dr4xx.cpp
+++ b/clang/test/CXX/drs/dr4xx.cpp
@@ -3,6 +3,7 @@
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
__extension__ typedef __SIZE_TYPE__ size_t;
@@ -79,6 +80,40 @@ namespace dr403 { // dr403: yes
// dr404: na
// (NB: also sup 594)
+namespace dr405 { // dr405: yes
+ // NB: also dup 218
+ namespace A {
+ struct S {};
+ void f(S);
+ }
+ namespace B {
+ struct S {};
+ void f(S);
+ }
+
+ struct C {
+ int f;
+ void test1(A::S as) { f(as); } // expected-error {{called object type 'int'}}
+ void test2(A::S as) { void f(); f(as); } // expected-error {{too many arguments}} expected-note {{}}
+ void test3(A::S as) { using A::f; f(as); } // ok
+ void test4(A::S as) { using B::f; f(as); } // ok
+ void test5(A::S as) { int f; f(as); } // expected-error {{called object type 'int'}}
+ void test6(A::S as) { struct f {}; (void) f(as); } // expected-error {{no matching conversion}} expected-note +{{}}
+ };
+
+ namespace D {
+ struct S {};
+ struct X { void operator()(S); } f;
+ }
+ void testD(D::S ds) { f(ds); } // expected-error {{undeclared identifier}}
+
+ namespace E {
+ struct S {};
+ struct f { f(S); };
+ }
+ void testE(E::S es) { f(es); } // expected-error {{undeclared identifier}}
+}
+
namespace dr406 { // dr406: yes
typedef struct {
static int n; // expected-error {{static data member 'n' not allowed in anonymous struct}}
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 73d238354bd5b..befe27262850c 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2470,7 +2470,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://wg21.link/cwg405">405</a></td>
<td>CD6</td>
<td>Unqualified function name lookup</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="406">
<td><a href="https://wg21.link/cwg406">406</a></td>
More information about the cfe-commits
mailing list