This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGaa7aedd8ea3f: [clang] Add test for CWG1837 (authored by Endill).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148035/new/ https://reviews.llvm.org/D148035 Files: clang/test/CXX/drs/dr18xx.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 @@ -10829,7 +10829,7 @@ <td><a href="https://wg21.link/cwg1837">1837</a></td> <td>CD6</td> <td>Use of <TT>this</TT> in <TT>friend</TT> and local class declarations</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Clang 3.3</td> </tr> <tr id="1838"> <td><a href="https://wg21.link/cwg1838">1838</a></td> Index: clang/test/CXX/drs/dr18xx.cpp =================================================================== --- clang/test/CXX/drs/dr18xx.cpp +++ clang/test/CXX/drs/dr18xx.cpp @@ -2,7 +2,8 @@ // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors #if __cplusplus < 201103L // expected-error@+1 {{variadic macro}} @@ -59,6 +60,43 @@ #endif } +namespace dr1837 { // dr1837: 3.3 +#if __cplusplus >= 201103L + template <typename T> + struct Fish { static const bool value = true; }; + + struct Other { + int p(); + auto q() -> decltype(p()) *; + }; + + class Outer { + friend auto Other::q() -> decltype(this->p()) *; // expected-error {{invalid use of 'this'}} + int g(); + int f() { + extern void f(decltype(this->g()) *); + struct Inner { + static_assert(Fish<decltype(this->g())>::value, ""); // expected-error {{invalid use of 'this'}} + enum { X = Fish<decltype(this->f())>::value }; // expected-error {{invalid use of 'this'}} + struct Inner2 : Fish<decltype(this->g())> { }; // expected-error {{invalid use of 'this'}} + friend void f(decltype(this->g()) *); // expected-error {{invalid use of 'this'}} + friend auto Other::q() -> decltype(this->p()) *; // expected-error {{invalid use of 'this'}} + }; + return 0; + } + }; + + struct A { + int f(); + bool b = [] { + struct Local { + static_assert(sizeof(this->f()) == sizeof(int), ""); + }; + }; + }; +#endif +} + namespace dr1872 { // dr1872: 9 #if __cplusplus >= 201103L template<typename T> struct A : T {
Index: clang/www/cxx_dr_status.html =================================================================== --- clang/www/cxx_dr_status.html +++ clang/www/cxx_dr_status.html @@ -10829,7 +10829,7 @@ <td><a href="https://wg21.link/cwg1837">1837</a></td> <td>CD6</td> <td>Use of <TT>this</TT> in <TT>friend</TT> and local class declarations</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Clang 3.3</td> </tr> <tr id="1838"> <td><a href="https://wg21.link/cwg1838">1838</a></td> Index: clang/test/CXX/drs/dr18xx.cpp =================================================================== --- clang/test/CXX/drs/dr18xx.cpp +++ clang/test/CXX/drs/dr18xx.cpp @@ -2,7 +2,8 @@ // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors #if __cplusplus < 201103L // expected-error@+1 {{variadic macro}} @@ -59,6 +60,43 @@ #endif } +namespace dr1837 { // dr1837: 3.3 +#if __cplusplus >= 201103L + template <typename T> + struct Fish { static const bool value = true; }; + + struct Other { + int p(); + auto q() -> decltype(p()) *; + }; + + class Outer { + friend auto Other::q() -> decltype(this->p()) *; // expected-error {{invalid use of 'this'}} + int g(); + int f() { + extern void f(decltype(this->g()) *); + struct Inner { + static_assert(Fish<decltype(this->g())>::value, ""); // expected-error {{invalid use of 'this'}} + enum { X = Fish<decltype(this->f())>::value }; // expected-error {{invalid use of 'this'}} + struct Inner2 : Fish<decltype(this->g())> { }; // expected-error {{invalid use of 'this'}} + friend void f(decltype(this->g()) *); // expected-error {{invalid use of 'this'}} + friend auto Other::q() -> decltype(this->p()) *; // expected-error {{invalid use of 'this'}} + }; + return 0; + } + }; + + struct A { + int f(); + bool b = [] { + struct Local { + static_assert(sizeof(this->f()) == sizeof(int), ""); + }; + }; + }; +#endif +} + namespace dr1872 { // dr1872: 9 #if __cplusplus >= 201103L template<typename T> struct A : T {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits