• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include <stdio.h>
11 
12 template <class T> class A
13 {
14 public:
15   void accessMember(T a);
16   T accessMemberConst() const;
17   static int accessStaticMember();
18 
accessMemberInline(T a)19   void accessMemberInline(T a) __attribute__ ((always_inline))
20   {
21     m_a = a; // breakpoint 4
22   }
23 
24   T m_a;
25   static int s_a;
26 };
27 
28 template <class T> int A<T>::s_a = 5;
29 
accessMember(T a)30 template <class T> void A<T>::accessMember(T a)
31 {
32   m_a = a; // breakpoint 1
33 }
34 
accessMemberConst() const35 template <class T> T A<T>::accessMemberConst() const
36 {
37   return m_a; // breakpoint 2
38 }
39 
accessStaticMember()40 template <class T> int A<T>::accessStaticMember()
41 {
42   return s_a; // breakpoint 3
43 }
44 
main()45 int main()
46 {
47   A<int> my_a;
48 
49   my_a.accessMember(3);
50   my_a.accessMemberConst();
51   A<int>::accessStaticMember();
52   my_a.accessMemberInline(5);
53 }
54