[clang] 57c10b0 - Add C++20 diagnostic to macro-braces-recovery.cpp. (#192654)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 02:36:17 PDT 2026


Author: Tom Weaver
Date: 2026-04-23T10:36:12+01:00
New Revision: 57c10b0b8032bfcbd39290e44f11c49b684f1c3a

URL: https://github.com/llvm/llvm-project/commit/57c10b0b8032bfcbd39290e44f11c49b684f1c3a
DIFF: https://github.com/llvm/llvm-project/commit/57c10b0b8032bfcbd39290e44f11c49b684f1c3a.diff

LOG: Add C++20 diagnostic to macro-braces-recovery.cpp. (#192654)

Add C++20 diagnostic to macro-braces-recovery.cpp.

For C++17 (clang's default standard) this test passes fine. For C++20 or
above standards as default this test produces an additional diagnostic
for reverse order candidate conversion functions.

To fix this I've added a --std=c++17 to the original run line,
introduced a second run line for C++20 and a cxx20-note expectation for
the new language spec diagnostic.

Added: 
    

Modified: 
    clang/test/Parser/macro-braces-recovery.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Parser/macro-braces-recovery.cpp b/clang/test/Parser/macro-braces-recovery.cpp
index e8842f44bd623..bb58c2b8fe689 100644
--- a/clang/test/Parser/macro-braces-recovery.cpp
+++ b/clang/test/Parser/macro-braces-recovery.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected -std=c++17 %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx20 -std=c++20 %s
 
 namespace GH21755 {
 #define M(x) f x // expected-note {{macro 'M' defined here}}
@@ -16,7 +17,8 @@ class Foo { // expected-note {{candidate constructor (the implicit copy construc
             // expected-note {{candidate constructor (the implicit move constructor) not viable}}
 public:
   Foo(int); // expected-note {{candidate constructor not viable: requires 1 argument, but 2 were provided}}
-  bool operator==(const int l); // expected-note {{candidate function not viable: no known conversion from 'Foo' to 'const int' for 1st argument}}
+  bool operator==(const int l); // expected-note {{candidate function not viable: no known conversion from 'Foo' to 'const int' for 1st argument}} \
+                                // cxx20-note {{candidate function (with reversed parameter order) not viable: no known conversion from 'Foo' to 'const int' for object argument}}
 };
 #define EQ(x,y) (void)(x == y) // expected-note {{macro 'EQ' defined here}}
 


        


More information about the cfe-commits mailing list