This revision was automatically updated to reflect the committed changes. Closed by commit rG1bbaabb90dd7: [clang] Add test for CWG1710 and related issues (authored by Endill).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D151697/new/ https://reviews.llvm.org/D151697 Files: clang/test/CXX/drs/dr17xx.cpp clang/test/CXX/drs/dr18xx.cpp clang/test/CXX/drs/dr3xx.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 @@ -1923,7 +1923,7 @@ <td><a href="https://cplusplus.github.io/CWG/issues/314.html">314</a></td> <td>C++17</td> <td><TT>template</TT> in base class specifier</td> - <td class="none" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr id="315"> <td><a href="https://cplusplus.github.io/CWG/issues/315.html">315</a></td> @@ -2097,7 +2097,7 @@ <td><a href="https://cplusplus.github.io/CWG/issues/343.html">343</a></td> <td>C++17</td> <td>Make <TT>template</TT> optional in contexts that require a type</td> - <td class="none" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr id="344"> <td><a href="https://cplusplus.github.io/CWG/issues/344.html">344</a></td> @@ -10067,7 +10067,7 @@ <td><a href="https://cplusplus.github.io/CWG/issues/1710.html">1710</a></td> <td>C++17</td> <td>Missing <TT>template</TT> keyword in <I>class-or-decltype</I></td> - <td class="none" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr id="1711"> <td><a href="https://cplusplus.github.io/CWG/issues/1711.html">1711</a></td> @@ -10571,7 +10571,7 @@ <td><a href="https://cplusplus.github.io/CWG/issues/1794.html">1794</a></td> <td>C++17</td> <td><TT>template</TT> keyword and alias templates</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="1795"> <td><a href="https://cplusplus.github.io/CWG/issues/1795.html">1795</a></td> @@ -10679,7 +10679,7 @@ <td><a href="https://cplusplus.github.io/CWG/issues/1812.html">1812</a></td> <td>C++17</td> <td>Omission of <TT>template</TT> in a <I>typename-specifier</I></td> - <td class="none" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr id="1813"> <td><a href="https://cplusplus.github.io/CWG/issues/1813.html">1813</a></td> Index: clang/test/CXX/drs/dr3xx.cpp =================================================================== --- clang/test/CXX/drs/dr3xx.cpp +++ clang/test/CXX/drs/dr3xx.cpp @@ -208,14 +208,20 @@ #endif } -namespace dr314 { // FIXME 314: dup 1710 - template<typename T> struct A { - template<typename U> struct B {}; - }; - template<typename T> struct C : public A<T>::template B<T> { - C() : A<T>::template B<T>() {} - }; -} +namespace dr314 { // dr314: no + // NB: dup 1710 +template <typename T> struct A { + template <typename U> struct B {}; +}; +template <typename T> struct C : public A<T>::template B<T> { + C() : A<T>::template B<T>() {} +}; +template <typename T> struct C2 : public A<T>::B<T> { + // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}} + C2() : A<T>::B<T>() {} + // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}} +}; +} // namespace dr314 // dr315: na // dr316: sup 1004 @@ -591,7 +597,7 @@ // dr342: na -namespace dr343 { // FIXME 343: no +namespace dr343 { // dr343: no // FIXME: dup 1710 template<typename T> struct A { template<typename U> struct B {}; Index: clang/test/CXX/drs/dr18xx.cpp =================================================================== --- clang/test/CXX/drs/dr18xx.cpp +++ clang/test/CXX/drs/dr18xx.cpp @@ -4,12 +4,23 @@ // 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++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors #if __cplusplus < 201103L // expected-error@+1 {{variadic macro}} #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) #endif +namespace dr1812 { // dr1812: no + // NB: dup 1710 +#if __cplusplus >= 201103L +template <typename T> struct A { + using B = typename T::C<int>; + // expected-error@-1 {{use 'template' keyword to treat 'C' as a dependent template name}} +}; +#endif +} // namespace dr1812 + namespace dr1813 { // dr1813: 7 struct B { int i; }; struct C : B {}; Index: clang/test/CXX/drs/dr17xx.cpp =================================================================== --- clang/test/CXX/drs/dr17xx.cpp +++ clang/test/CXX/drs/dr17xx.cpp @@ -1,7 +1,22 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -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++1z %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++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify -fexceptions -fcxx-exceptions -pedantic-errors + +namespace dr1710 { // dr1710: no +// FIXME: all of the following is well-formed +template <typename T> struct D1 : T::template B<int>::template C<int> {}; +template <typename T> struct D2 : T::B<int>::template C<int> {}; +// expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}} +template <typename T> struct D3 : T::template B<int>::C<int> {}; +// expected-error@-1 {{use 'template' keyword to treat 'C' as a dependent template name}} +template <typename T> struct D4 : T::B<int>::C<int> {}; +// expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}} +// expected-error@-2 {{use 'template' keyword to treat 'C' as a dependent template name}} +} // namespace dr1710 namespace dr1715 { // dr1715: 3.9 #if __cplusplus >= 201103L @@ -146,3 +161,18 @@ static_assert(noexcept(D()), ""); #endif } + +namespace dr1794 { // dr1794: yes + // NB: dup 1710 +#if __cplusplus >= 201103L +template <template <typename> class Template> struct Internal { + template <typename Arg> using Bind = Template<Arg>; +}; + +template <template <typename> class Template, typename Arg> +using Instantiate = Template<Arg>; + +template <template <typename> class Template, typename Argument> +using Bind = Instantiate<Internal<Template>::template Bind, Argument>; +#endif +} // namespace dr1794
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits