llvm-capstone/clang/test/AST/ast-dump-default-arg-recovery.cpp
Kadir Cetinkaya 373fcd5d73
[clang] Use RecoveryExprs for broken defaultargs, instead of OpaqueValueExprs
This makes sure we can preserve invalid-ness for consumers of this
node, it prevents crashes. It also aligns better with rest of the places that
store invalid expressions.

Differential Revision: https://reviews.llvm.org/D157868
2023-08-16 10:22:16 +02:00

9 lines
451 B
C++

// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ast-dump -frecovery-ast %s | FileCheck %s
void foo();
void fun(int arg = foo());
// CHECK: -ParmVarDecl {{.*}} <col:10, col:24> col:14 invalid arg 'int' cinit
// CHECK-NEXT: -RecoveryExpr {{.*}} <col:18, col:24> 'int' contains-errors
// Make sure we also preserve structure of the errorneous expression
// CHECK: -DeclRefExpr {{.*}} <col:20> 'void ()' {{.*}} 'foo'