TestLanguage Language;
std::string Target;
+ bool isC99OrLater() const { return Language == Lang_C99; }
+
bool isCXX() const {
return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14 || Language == Lang_CXX17 ||
int a[10];
int b[1][2][3];
int c[] = {1,2,3};
-// void f(int xs[static 10]);
)cpp",
R"txt(
*: TranslationUnit
`-; )txt");
}
+TEST_P(SyntaxTreeTest, StaticArraySubscriptsInDeclarators) {
+ if (!GetParam().isC99OrLater()) {
+ return;
+ }
+ expectTreeDumpEqual(
+ R"cpp(
+void f(int xs[static 10]);
+ )cpp",
+ R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+ |-void
+ |-SimpleDeclarator
+ | |-f
+ | `-ParametersAndQualifiers
+ | |-(
+ | |-SimpleDeclaration
+ | | |-int
+ | | `-SimpleDeclarator
+ | | |-xs
+ | | `-ArraySubscript
+ | | |-[
+ | | |-static
+ | | |-UnknownExpression
+ | | | `-10
+ | | `-]
+ | `-)
+ `-; )txt");
+}
+
TEST_P(SyntaxTreeTest, ParameterListsInDeclarators) {
if (!GetParam().isCXX()) {
// TODO: Split parts that depend on C++ into a separate test.