1 //===-- main.cpp ------------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include <stdio.h> 10 11 template <class T> class A 12 { 13 public: 14 void accessMember(T a); 15 T accessMemberConst() const; 16 static int accessStaticMember(); 17 18 void accessMemberInline(T a) __attribute__ ((always_inline)) 19 { 20 m_a = a; // breakpoint 4 21 } 22 23 T m_a; 24 static int s_a; 25 }; 26 27 template <class T> int A<T>::s_a = 5; 28 29 template <class T> void A<T>::accessMember(T a) 30 { 31 m_a = a; // breakpoint 1 32 } 33 34 template <class T> T A<T>::accessMemberConst() const 35 { 36 return m_a; // breakpoint 2 37 } 38 39 template <class T> int A<T>::accessStaticMember() 40 { 41 return s_a; // breakpoint 3 42 } 43 44 int main() 45 { 46 A<int> my_a; 47 48 my_a.accessMember(3); 49 my_a.accessMemberConst(); 50 A<int>::accessStaticMember(); 51 my_a.accessMemberInline(5); 52 } 53