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

14 lines
578 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 -std=c++1z -verify %s
void f() noexcept;
void (&r)() = f;
void (&s)() noexcept = r; // expected-error {{cannot bind}}
void (&cond1)() noexcept = true ? r : f; // expected-error {{cannot bind}}
void (&cond2)() noexcept = true ? f : r; // expected-error {{cannot bind}}
// FIXME: Strictly, the rules in p4 don't allow this, because the operand types
// are not of the same type other than cv-qualifiers, but we consider that to
// be a defect, and instead allow reference-compatible types here.
void (&cond3)() = true ? r : f;
void (&cond4)() = true ? f : r;