llvm-project/clang-tools-extra/pseudo/test/cxx/structured-binding.cpp
Haojian Wu f7dc91ad56 [pseudo] Eliminate a false parse of structured binding declaration.
Using the guard to implement part of the rule https://eel.is/c++draft/dcl.pre#6.

```
void foo() {
  // can be parsed as
  //   - structured-binding declaration (a false parse)
  //   - assignment expression
  array[index] = value;
}
```

Differential Revision: https://reviews.llvm.org/D132260
2022-08-23 15:25:52 +02:00

7 lines
314 B
C++

// RUN: clang-pseudo -grammar=cxx -source=%s --start-symbol=statement-seq --print-forest | FileCheck %s
// Verify there is no false parse of the structured binding declaration.
ABC[post] = abc;
// CHECK: statement-seq~expression-statement := expression ;
// CHECK: postfix-expression [ expr-or-braced-init-list ]