Skip to content

[clang] Add tests for some CWG issues from 2024-05-31 telecon #94167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 88 additions & 7 deletions clang/test/CXX/drs/cwg28xx.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -std=c++98 -verify=expected %s
// RUN: %clang_cc1 -std=c++11 -verify=expected %s
// RUN: %clang_cc1 -std=c++14 -verify=expected %s
// RUN: %clang_cc1 -std=c++17 -verify=expected %s
// RUN: %clang_cc1 -std=c++20 -verify=expected,since-cxx20 %s
// RUN: %clang_cc1 -std=c++23 -verify=expected,since-cxx20,since-cxx23 %s
// RUN: %clang_cc1 -std=c++2c -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s
// RUN: %clang_cc1 -std=c++98 -pedantic-errors -verify=expected,cxx98 %s
// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected,since-cxx20 %s
// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected,since-cxx20,since-cxx23 %s
// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s

namespace cwg2819 { // cwg2819: 19 tentatively ready 2023-12-01
#if __cpp_constexpr >= 202306L
Expand Down Expand Up @@ -110,6 +110,26 @@ struct A {

} // namespace cwg2858

namespace cwg2877 { // cwg2877: no tentatively ready 2024-05-31
#if __cplusplus >= 202002L
enum E { x };
void f() {
int E;
// FIXME: OK, names ::E
using enum E;
// since-cxx20-error@-1 {{unknown type name E}}
}
using F = E;
using enum F; // OK, designates ::E
template<class T> using EE = T;
void g() {
// FIXME: OK, designates ::E
using enum EE<E>;
// since-cxx20-error@-1 {{using enum requires an enum or typedef name}}
}
#endif
} // namespace cwg2877

namespace cwg2881 { // cwg2881: 19 tentatively ready 2024-04-19

#if __cplusplus >= 202302L
Expand Down Expand Up @@ -180,3 +200,64 @@ void f() {

} // namespace cwg2881

namespace cwg2882 { // cwg2882: 2.7 tentatively ready 2024-05-31
struct C {
operator void() = delete;
// expected-warning@-1 {{conversion function converting 'cwg2882::C' to 'void' will never be used}}
// cxx98-error@-2 {{deleted function definitions are a C++11 extension}}
};

void f(C c) {
(void)c;
}
} // namespace cwg2882

namespace cwg2883 { // cwg2883: no tentatively ready 2024-05-31
#if __cplusplus >= 201103L
void f() {
int x;
(void)[&] {
return x;
};
}
#endif
#if __cplusplus >= 202002L
struct A {
A() = default;
A(const A &) = delete; // #cwg2883-A-copy-ctor
constexpr operator int() { return 42; }
};
void g() {
constexpr A a;
// FIXME: OK, not odr-usable from a default template argument, and not odr-used
(void)[=]<typename T, int = a> {};
// since-cxx20-error@-1 {{call to deleted constructor of 'const A'}}
// since-cxx20-note@#cwg2883-A-copy-ctor {{'A' has been explicitly marked deleted here}}
}
#endif
} // namespace cwg2883

Comment on lines +230 to +238
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do emit a diag later https://compiler-explorer.com/z/bd39GcqMP
I think it's still fair to say it's not implemented

namespace cwg2885 { // cwg2885: 16 tentatively ready 2024-05-31
#if __cplusplus >= 202002L
template <class T>
struct A {
A() requires (false) = default;
A() : t(42) {}
T t;
};

struct B : A<int> {};
static_assert(!__is_trivially_constructible(B));
#endif
} // namespace cwg2885

namespace cwg2886 { // cwg2886: 9 tentatively ready 2024-05-31
#if __cplusplus >= 201103L
struct C {
C() = default;
~C() noexcept(false) = default;
};

static_assert(noexcept(C()), "");
#endif
} // namespace cwg2886
10 changes: 5 additions & 5 deletions clang/www/cxx_dr_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -17071,7 +17071,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2877.html">2877</a></td>
<td>tentatively ready</td>
<td>Type-only lookup for <I>using-enum-declarator</I></td>
<td align="center">Not resolved</td>
<td title="Clang does not implement 2024-05-31 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2878">
<td><a href="https://cplusplus.github.io/CWG/issues/2878.html">2878</a></td>
Expand Down Expand Up @@ -17101,13 +17101,13 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2882.html">2882</a></td>
<td>tentatively ready</td>
<td>Unclear treatment of conversion to <TT>void</TT></td>
<td align="center">Not resolved</td>
<td title="Clang 2.7 implements 2024-05-31 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2883">
<td><a href="https://cplusplus.github.io/CWG/issues/2883.html">2883</a></td>
<td>tentatively ready</td>
<td>Definition of "odr-usable" ignores lambda scopes</td>
<td align="center">Not resolved</td>
<td title="Clang does not implement 2024-05-31 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="2884">
<td><a href="https://cplusplus.github.io/CWG/issues/2884.html">2884</a></td>
Expand All @@ -17119,13 +17119,13 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2885.html">2885</a></td>
<td>tentatively ready</td>
<td>Non-eligible trivial default constructors</td>
<td align="center">Not resolved</td>
<td title="Clang 16 implements 2024-05-31 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2886">
<td><a href="https://cplusplus.github.io/CWG/issues/2886.html">2886</a></td>
<td>tentatively ready</td>
<td>Temporaries and trivial potentially-throwing special member functions</td>
<td align="center">Not resolved</td>
<td title="Clang 9 implements 2024-05-31 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2887">
<td><a href="https://cplusplus.github.io/CWG/issues/2887.html">2887</a></td>
Expand Down
Loading