p2.cpp revision 55dec868977ccb89cab0286122f9345f63bb5de7
1// RUN: %clang_cc1 -std=c++0x -emit-llvm %s -o - | FileCheck %s
2
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