| 1 | // RUN: %clang_cc1 -std=c++11 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s |
| 2 | |
| 3 | // constexpr functions and constexpr constructors are implicitly inline. |
| 4 | struct S { |
| 5 | constexpr S(int n); |
| 6 | constexpr int g(); |
| 7 | int n; |
| 8 | }; |
| 9 | |
| 10 | constexpr S::S(int n) : n(n) {} |
| 11 | |
| 12 | constexpr S f(S s) { |
| 13 | return s.n * 2; |
| 14 | } |
| 15 | |
| 16 | constexpr 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 | |
| 24 | int g() { |
| 25 | return f(42).g(); |
| 26 | } |
| 27 | |