| 1 |
// RUN: %clang_analyze_cc1 -analyzer-output=plist -o %t.plist -std=c++11 -analyzer-checker=core %s |
| 2 |
// RUN: FileCheck --input-file=%t.plist %s |
| 3 |
|
| 4 |
bool ret(); |
| 5 |
|
| 6 |
template <class A, class B, class C, int N> |
| 7 |
struct DivByZero { |
| 8 |
int i; |
| 9 |
DivByZero(bool b) { |
| 10 |
if (ret()) |
| 11 |
i = 50 / (b - 1); |
| 12 |
} |
| 13 |
}; |
| 14 |
|
| 15 |
template <class B, class C, int N> |
| 16 |
struct DivByZero<char, B, C, N> { |
| 17 |
int i; |
| 18 |
DivByZero(bool b) { |
| 19 |
if (ret()) |
| 20 |
i = 50 / (b - 1); |
| 21 |
} |
| 22 |
}; |
| 23 |
|
| 24 |
template <typename... Args> |
| 25 |
struct DivByZeroVariadic { |
| 26 |
int i; |
| 27 |
DivByZeroVariadic(bool b) { |
| 28 |
if (ret()) |
| 29 |
i = 50 / (b - 1); |
| 30 |
} |
| 31 |
}; |
| 32 |
|
| 33 |
int main() { |
| 34 |
DivByZero<int, float, double, 0> a(1); |
| 35 |
DivByZero<char, float, double, 0> a2(1); |
| 36 |
DivByZeroVariadic<char, float, double, decltype(nullptr)> a3(1); |
| 37 |
} |
| 38 |
|
| 39 |
// CHECK: <string>Calling constructor for 'DivByZero<int, float, double, 0>'</string> |
| 40 |
// CHECK: <string>Calling constructor for 'DivByZero<char, float, double, 0>'</string> |
| 41 |
// CHECK: <string>Calling constructor for 'DivByZeroVariadic<char, float, double, std::nullptr_t>'</string> |
| 42 |
|