https://github.com/TPPPP72 created https://github.com/llvm/llvm-project/pull/228889
Follow-up #211221 >From 9f3f1c756db4a3dd3dd43402d7b11d81905a2413 Mon Sep 17 00:00:00 2001 From: Shengxin Pei <[email protected]> Date: Sun, 4 Oct 2026 21:01:21 +0800 Subject: [PATCH] [clang][test] Combine and clean up decltype parser tests NFC --- clang/test/Parser/decltype-crash.cpp | 39 +++++++++++++++---------- clang/test/Parser/decltype-gh188014.cpp | 4 --- clang/test/Parser/gh114815.cpp | 6 ---- 3 files changed, 23 insertions(+), 26 deletions(-) delete mode 100644 clang/test/Parser/decltype-gh188014.cpp delete mode 100644 clang/test/Parser/gh114815.cpp diff --git a/clang/test/Parser/decltype-crash.cpp b/clang/test/Parser/decltype-crash.cpp index 8471309665f1d..9f22baef698d5 100644 --- a/clang/test/Parser/decltype-crash.cpp +++ b/clang/test/Parser/decltype-crash.cpp @@ -1,20 +1,27 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s -// A 'decltype' that is not followed by '(' fails to parse as a -// decltype-specifier. ParseOptionalCXXScopeSpecifier used to still annotate it -// and treat it as a nested-name-specifier, which tripped an assertion in -// Preprocessor::AnnotatePreviousCachedTokens. It should just diagnose the -// error instead. -int decltype = 0; -// expected-error@-1 {{expected '(' after 'decltype'}} -// expected-error@-2 {{expected unqualified-id}} +namespace GH114815{ + #define ID(X) X + extern int ID(decltype); + // expected-error@-1 {{expected '(' after 'decltype'}} + // expected-error@-2 {{expected unqualified-id}} +} -int *decltype = 0; -// expected-error@-1 {{expected '(' after 'decltype'}} -// expected-error@-2 {{expected unqualified-id}} +namespace GH165246 { + int decltype {}; + // expected-error@-1 {{expected '(' after 'decltype'}} + // expected-error@-2 {{expected unqualified-id}} +} -// GH165246 -int decltype {}; -// expected-error@-1 {{expected '(' after 'decltype'}} -// expected-error@-2 {{expected unqualified-id}} +namespace GH211207 { + int decltype = 0; + // expected-error@-1 {{expected '(' after 'decltype'}} + // expected-error@-2 {{expected unqualified-id}} + + int *decltype = 0; + // expected-error@-1 {{expected '(' after 'decltype'}} + // expected-error@-2 {{expected unqualified-id}} +} + +// GH188014 +& decltype ( ( union { // expected-error {{expected ';' after union}} expected-error {{expected '}'}} expected-error {{expected ')'}} expected-error {{expected expression}} expected-error {{expected unqualified-id}} expected-note {{to match this '('}} expected-note {{to match this '{'}} diff --git a/clang/test/Parser/decltype-gh188014.cpp b/clang/test/Parser/decltype-gh188014.cpp deleted file mode 100644 index e8403bdcbe3bb..0000000000000 --- a/clang/test/Parser/decltype-gh188014.cpp +++ /dev/null @@ -1,4 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s - -// GH188014 -& decltype ( ( union { // expected-error {{expected ';' after union}} expected-error {{expected '}'}} expected-error {{expected ')'}} expected-error {{expected expression}} expected-error {{expected unqualified-id}} expected-note {{to match this '('}} expected-note {{to match this '{'}} diff --git a/clang/test/Parser/gh114815.cpp b/clang/test/Parser/gh114815.cpp deleted file mode 100644 index 6a89384e9e66d..0000000000000 --- a/clang/test/Parser/gh114815.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %clang_cc1 -verify %s -std=c++11 -fsyntax-only - -#define ID(X) X -extern int ID(decltype); -// expected-error@-1 {{expected '(' after 'decltype'}} \ -// expected-error@-1 {{expected unqualified-id}} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
