@@ -23,7 +23,7 @@ class A {
2323
2424 int complexCalculation ();
2525
26- int gcd (int a, int b) {
26+ int gcd (int a, int b) { // NON_COMPLIANT
2727 if (b == 0 )
2828 return a;
2929 int result = gcd (b, (a % b));
@@ -55,11 +55,11 @@ inline int A::complexCalculation() { // COMPLIANT
5555 return 1 ;
5656}
5757
58- int A::getB () { return 1 ; } // NON_COMPLIANT
58+ int A::getB () { return 1 ; } // COMPLIANT
5959
60- template <typename T> T A::d (T t) { return t; } // NON_COMPLIANT
60+ template <typename T> T A::d (T t) { return t; } // COMPLIANT
6161
62- int A::b () { return 3 ; } // NON_COMPLIANT
62+ int A::b () { return 3 ; } // COMPLIANT
6363
6464template <typename C> class B {
6565public:
@@ -76,9 +76,30 @@ template <typename C> class B {
7676 template <typename T> T d (T t);
7777
7878 int complexCalculation ();
79+
80+ int complexCalculation2 () { // COMPLIANT - template
81+ ;
82+ ;
83+ ;
84+ ;
85+ ;
86+ ;
87+ ;
88+ ;
89+ ;
90+ ;
91+ ;
92+ ;
93+ return 1 ;
94+ }
7995};
8096
81- template <typename C> inline int B<C>::complexCalculation() { // NON_COMPLIANT
97+ void test_B () {
98+ B<int > b;
99+ b.complexCalculation2 ();
100+ }
101+
102+ template <typename C> inline int B<C>::complexCalculation() { // COMPLIANT
82103 ;
83104 ;
84105 ;
@@ -94,16 +115,16 @@ template <typename C> inline int B<C>::complexCalculation() { // NON_COMPLIANT
94115 return 1 ;
95116}
96117
97- template <typename C> template <typename T> T B<C>::d(T t) { // NON_COMPLIANT
118+ template <typename C> template <typename T> T B<C>::d(T t) { // COMPLIANT
98119 return t;
99120}
100121
101- template <typename C> int B<C>::b() { // NON_COMPLIANT
122+ template <typename C> int B<C>::b() { // COMPLIANT
102123 C c;
103124 return 3 ;
104125}
105126
106- template <typename C> int B<C>::getB() { return 3 ; } // NON_COMPLIANT
127+ template <typename C> int B<C>::getB() { return 3 ; } // COMPLIANT
107128
108129template <typename T> class Foo {
109130public:
@@ -121,8 +142,30 @@ class FooBar {
121142public:
122143 ~FooBar ();
123144 int f1 (int a, int b);
145+
146+ template <typename C> int complexCalculation () { // COMPLIANT - template
147+ ;
148+ ;
149+ ;
150+ ;
151+ ;
152+ ;
153+ ;
154+ ;
155+ ;
156+ ;
157+ ;
158+ ;
159+ return 1 ;
160+ }
124161};
125162
163+ void test_FooBar () {
164+ FooBar foobar;
165+ foobar.complexCalculation <int >();
166+ }
167+
168+
126169FooBar::~FooBar () {} // COMPLIANT want to ignore pImpl uses of destructors
127170
128171int FooBar::f1 (int a, int b) { // COMPLIANT not a trivial function
0 commit comments