brintos

brintos / llvm-project-archived public Read only

0
0
Text · 483 B · e673680 Raw
17 lines · cpp
1// RUN: %clang_analyze_cc1 -std=c++23 -analyzer-checker=core -verify %s2// RUN: %clang_analyze_cc1 -std=c++26 -analyzer-checker=core -verify %s3 4void test_consteval() {5  if consteval {6    int *ptr = nullptr;7    *ptr = 42; // expected-warning{{Dereference of null pointer (loaded from variable 'ptr')}}8  }9}10 11void test_not_consteval() {12  if !consteval {13    int *ptr = nullptr;14    *ptr = 42; // expected-warning{{Dereference of null pointer (loaded from variable 'ptr')}}15  }16}17