blob: 4e5b670f76eac4b54e6b07cd50c2f21696efa9f6 [file] [log] [blame]
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// RUN: cxx_compiler cxx_11 -c %s -o %t.o
// RUN: bindump %t.o | FileCheck prefixes %s
// References to declared entities
// CHECK-DAG: _Z3fooc{{$}}
void foo(char) {}
template <void (&)(char)> struct CB {};
// CHECK-DAG: _Z3bar2CBIL_Z3foocEE
void bar(CB<foo> cb) {}
// CHECK-DAG: _Z4test3CB2IL_Z7IsEmptyEE
extern "C" bool IsEmpty(char *);
template<bool (&)(char *)> struct CB2 {};
void test(CB2<IsEmpty> cb) {}
// CHECK-DAG: _Z3hhhI1QEDTpldtfp_1xdtL_Z1qE1xET_
struct Q {int x; } q;
template<class T> auto hhh(T p)->decltype(p.x + q.x);
template <> auto hhh(Q p)->decltype(p.x + q.x) { return 0; }
// CHECK-DAG: _Z3iiiI2Q1EDTpldtfp_1xL_ZN1Q1xEEET_
struct Q1 {int x; } q1;
template<class T> auto iii(T p)->decltype(p.x + Q::x);
template<> auto iii(Q1 p)->decltype(p.x + Q::x) { return 0; }
// CHECK-DAG: _Z3kkkI2S4EDTadsrT_onmiES1_
struct S4 {
S4 operator-(S4 rhs) { return rhs; }
};
template<class T> auto kkk(T p)->decltype(&T::operator-);
template<> auto kkk(S4 p)->decltype(&S4::operator-) { return 0; }