brintos

brintos / llvm-project-archived public Read only

0
0
Text · 725 B · 8987ac0 Raw
31 lines · cpp
1// RUN: %clang_analyze_cc1 -verify %s\2// RUN:   -analyzer-checker=core,debug.ExprInspection3 4void clang_analyzer_eval(bool);5 6using size_t = decltype(sizeof(int));7 8template <class FirstT, class... Rest>9void escape(FirstT first, Rest... args);10 11namespace CustomClassType {12struct S {13  int x;14  static void* operator new(size_t size) {15    return ::operator new(size);16  }17};18void F() {19  S *s = new S;20  clang_analyzer_eval(s->x); // expected-warning{{UNKNOWN}} FIXME: should be an undefined warning21 22  S *s2 = new S{};23  clang_analyzer_eval(0 == s2->x); // expected-warning{{TRUE}}24 25  S *s3 = new S{1};26  clang_analyzer_eval(1 == s3->x); // expected-warning{{TRUE}}27 28  escape(s, s2, s3);29}30} // namespace CustomClassType31