[clang] [clang-tools-extra] [Clang] Implement CWG2813: Class member access with prvalues (PR #95112)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 13 13:35:58 PDT 2024
================
@@ -124,21 +125,67 @@ void usage() {
}
}; // namespace p1771
-#ifdef EXT
-// expected-warning at 5 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 9 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 12 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 13 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 29 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 65 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 67 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 71 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 73 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 74 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 84 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 86 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 87 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 91 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning at 92 {{use of the 'nodiscard' attribute is a C++20 extension}}
-// expected-warning at 95 {{use of the 'nodiscard' attribute is a C++20 extension}}
+namespace discarded_member_access {
+struct X {
+ union {
+ int variant_member;
+ };
+ struct {
+ int anonymous_struct_member;
+ };
+ int data_member;
+ static int static_data_member;
+ enum {
+ unscoped_enum
+ };
+ enum class scoped_enum_t {
+ scoped_enum
+ };
+ using enum scoped_enum_t;
+ // cxx11-17-warning at -1 {{using enum declaration is a C++20 extension}}
+
+ void implicit_object_member_function();
+ static void static_member_function();
+#if __cplusplus >= 202302L
+ void explicit_object_member_function(this X self);
#endif
+};
+
----------------
Sirraide wrote:
This is missing tests for MS properties (though I’d maybe put those in a different file).
https://github.com/llvm/llvm-project/pull/95112
More information about the cfe-commits
mailing list