brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 3f45a43 Raw
43 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-output=plist -o %t.plist -std=c++11 -analyzer-checker=core %s2// RUN: FileCheck --input-file=%t.plist %s3 4bool ret();5 6template <class A, class B, class C, int N>7struct DivByZero {8  int i;9  DivByZero(bool b) {10    if (ret())11      i = 50 / (b - 1);12  }13};14 15template <class B, class C, int N>16struct DivByZero<char, B, C, N> {17  int i;18  DivByZero(bool b) {19    if (ret())20      i = 50 / (b - 1);21  }22};23 24template <typename... Args>25struct DivByZeroVariadic {26  int i;27  DivByZeroVariadic(bool b) {28    if (ret())29      i = 50 / (b - 1);30  }31};32 33int 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 &apos;DivByZero&lt;int, float, double, 0&gt;&apos;</string>40// CHECK:      <string>Calling constructor for &apos;DivByZero&lt;char, float, double, 0&gt;&apos;</string>41// CHECK:      <string>Calling constructor for &apos;DivByZeroVariadic&lt;char, float, double, std::nullptr_t&gt;&apos;</string>42 43