Kristof Umann | 3ea7442 | 2018-05-25 13:18:38 +0000 | [diff] [blame] | 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 T> |
| 7 | void f(int i) { |
| 8 | if (ret()) |
| 9 | i = i / (i - 5); |
| 10 | } |
| 11 | |
| 12 | template <> |
| 13 | void f<int>(int i) { |
| 14 | if (ret()) |
| 15 | i = i / (i - 5); |
| 16 | } |
| 17 | |
| 18 | template <int N = 0> |
| 19 | void defaultTemplateParameterFunction(int i) { |
| 20 | if (ret()) |
| 21 | int a = 10 / i; |
| 22 | } |
| 23 | |
| 24 | template <typename... Args> |
| 25 | void variadicTemplateFunction(int i) { |
| 26 | if (ret()) |
| 27 | int a = 10 / i; |
| 28 | } |
| 29 | |
| 30 | int main() { |
| 31 | f<int>(5); |
| 32 | f<float>(5); |
| 33 | defaultTemplateParameterFunction<>(0); |
| 34 | variadicTemplateFunction<char, float, double, int *>(0); |
| 35 | } |
| 36 | |
| 37 | // CHECK: <string>Calling 'f<float>'</string> |
| 38 | // CHECK: <string>Calling 'f<int>'</string> |
| 39 | // CHECK: <string>Calling 'defaultTemplateParameterFunction<0>'</string> |
| 40 | // CHECK: <string>Calling 'variadicTemplateFunction<char, float, double, int *>'</string> |
| 41 | |