llvm-for-llvmta/tools/clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4-ast.cpp

19 lines
634 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 -std=c++17 -ast-dump %s | FileCheck %s
void f() noexcept;
// CHECK: VarDecl {{.*}} ref 'void (&)()' cinit
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void ()':'void ()' lvalue <NoOp>
// CHECK-NEXT: DeclRefExpr {{.*}} 'void () noexcept' lvalue Function {{.*}} 'f' 'void () noexcept'
void (&ref)() = f;
struct X {
typedef void (&ref)() noexcept;
operator ref();
} x;
// CHECK: VarDecl {{.*}} xp 'void (&)()' cinit
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void ()':'void ()' lvalue <NoOp>
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void () noexcept':'void () noexcept' lvalue <UserDefinedConversion>
void (&xp)() = x;