brintos

brintos / llvm-project-archived public Read only

0
0
Text · 533 B · eeb5b6f Raw
27 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s2 3// constexpr functions and constexpr constructors are implicitly inline.4struct S {5  constexpr S(int n);6  constexpr int g();7  int n;8};9 10constexpr S::S(int n) : n(n) {}11 12constexpr S f(S s) {13  return s.n * 2;14}15 16constexpr int S::g() {17  return f(*this).n;18}19 20// CHECK: define linkonce_odr {{.*}} @_Z1f1S(21// CHECK: define linkonce_odr {{.*}} @_ZN1SC1Ei(22// CHECK: define linkonce_odr {{.*}} @_ZNK1S1gEv(23 24int g() {25  return f(42).g();26}27