brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · b1e4ecf Raw
66 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s2// RUN: not %clang_cc1 -ast-dump %s -std=c++17 | FileCheck %s3 4void test() {5  while(!!!) // expected-error {{expected expression}}6    int whileBody;7  // CHECK: WhileStmt8  // CHECK: RecoveryExpr {{.*}} <line:{{.*}}:9, col:11> 'bool'9  // CHECK: whileBody 'int'10 11  for(!!!) // expected-error {{expected expression}} expected-error {{expected ';'}}12    int forBody;13  // CHECK: ForStmt14  // FIXME: the AST should have a RecoveryExpr to distinguish from for(;;)15  // CHECK-NOT: RecoveryExpr16  // CHECK: forBody 'int'17 18  for(auto c : !!!) // expected-error {{expected expression}}19    int forEachBody;20  // FIXME: parse the foreach body21  // CHECK-NOT: CXXForRangeStmt22  // CHECK-NOT: forEachBody 'int'23 24  do25    int doBody;26  while(!!!); // expected-error {{expected expression}}27  // CHECK: DoStmt28  // CHECK: doBody 'int'29  // CHECK: RecoveryExpr {{.*}} <line:{{.*}}:9, col:11> 'bool'30 31  if(!!!) // expected-error {{expected expression}}32    int ifBody;33  else34    int elseBody;35  // CHECK: IfStmt36  // CHECK: RecoveryExpr {{.*}} <line:{{.*}}:6, col:8> 'bool'37  // CHECK: ifBody 'int'38  // CHECK: elseBody 'int'39 40  switch(!!!) // expected-error {{expected expression}}41    int switchBody;42  // CHECK: SwitchStmt43  // CHECK: RecoveryExpr {{.*}} <line:{{.*}}:10, col:12> 'int'44  // CHECK: switchBody 'int'45 46  switch (;) // expected-error {{expected expression}}47    int switchBody;48  // CHECK: SwitchStmt49  // CHECK: NullStmt50  // CHECK: RecoveryExpr {{.*}} <col:11> 'int'51  // CHECK: switchBody 'int'52 53  switch (;;) // expected-error {{expected expression}}54    int switchBody;55  // CHECK: SwitchStmt56  // CHECK: NullStmt57  // CHECK: RecoveryExpr {{.*}} <col:11, col:12> 'int'58  // CHECK: switchBody 'int'59 60  switch (!!!;) // expected-error {{expected expression}}61    int switchBody;62  // CHECK: SwitchStmt63  // CHECK: RecoveryExpr {{.*}} <line:{{.*}}:11, col:14> 'int'64  // CHECK: switchBody 'int'65}66