brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 5661a41 Raw
47 lines · cpp
1// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -ast-dump -frecovery-ast %s | FileCheck -strict-whitespace %s2 3// Check errors flag is set for RecoveryExpr.4//5// CHECK:     VarDecl {{.*}} a6// CHECK-NEXT:`-RecoveryExpr {{.*}} contains-errors7// CHECK-NEXT:  `-UnresolvedLookupExpr {{.*}} 'bar'8int a = bar();9 10// The flag propagates through more complicated calls.11//12// CHECK:     VarDecl {{.*}} b13// CHECK-NEXT:`-CallExpr {{.*}} contains-errors14// CHECK-NEXT:  |-UnresolvedLookupExpr {{.*}} 'bar'15// CHECK-NEXT:  |-RecoveryExpr {{.*}} contains-errors16// CHECK-NEXT:  | `-UnresolvedLookupExpr {{.*}} 'baz'17// CHECK-NEXT:   `-RecoveryExpr {{.*}} contains-errors18// CHECK-NEXT:     `-UnresolvedLookupExpr {{.*}} 'qux'19int b = bar(baz(), qux());20 21// Also propagates through more complicated expressions.22//23// CHECK:     |-VarDecl {{.*}} c24// CHECK-NEXT:| `-BinaryOperator {{.*}} '<dependent type>' contains-errors '*'25// CHECK-NEXT:|   |-UnaryOperator {{.*}} '<dependent type>' contains-errors prefix '&'26// CHECK-NEXT:|   | `-ParenExpr {{.*}} '<dependent type>' contains-errors27// CHECK-NEXT:|   |   `-BinaryOperator {{.*}} '<dependent type>' contains-errors '+'28// CHECK-NEXT:|   |     |-RecoveryExpr {{.*}} '<dependent type>' contains-errors29// CHECK-NEXT:|   |     | `-UnresolvedLookupExpr {{.*}} 'bar'30// CHECK-NEXT:|   |     `-RecoveryExpr {{.*}} '<dependent type>' contains-errors31// CHECK-NEXT:|   |       `-UnresolvedLookupExpr {{.*}} 'baz'32int c = &(bar() + baz()) * 10;33 34// Errors flag propagates even when type is not dependent anymore.35// CHECK:     |-VarDecl {{.*}} d36// CHECK-NEXT:| `-CXXStaticCastExpr {{.*}} 'int' contains-errors37// CHECK-NEXT:|   `-BinaryOperator {{.*}} '<dependent type>' contains-errors '+'38// CHECK-NEXT:|     |-RecoveryExpr {{.*}} '<dependent type>' contains-errors39// CHECK-NEXT:|     | `-UnresolvedLookupExpr {{.*}} 'bar'40// CHECK-NEXT:|     `-IntegerLiteral {{.*}} 141int d = static_cast<int>(bar() + 1);42 43 44// Error type should result in an invalid decl.45// CHECK: -VarDecl {{.*}} invalid f 'decltype(<recovery-expr>(bar))'46decltype(bar()) f;47