brintos

brintos / llvm-project-archived public Read only

0
0
Text · 864 B · c7ba432 Raw
31 lines · cpp
1// RUN: not %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:28:5 -fopenmp %s -o - 2>&1 | FileCheck %s2template <class T>3auto make_func() {4  struct impl {5    impl* func() {6      int x;7      if (x = 10) {8      #pragma omp parallel9        ;10      }11      // Check that body of this function is actually skipped.12      // CHECK-NOT: crash-skipped-bodies-template-inst.cpp:7:{{[0-9]+}}: warning: using the result of an assignment as a condition without parentheses13      return this;14    }15  };16 17  int x;18  if (x = 10) {}19  // Check that this function is not skipped.20  // CHECK: crash-skipped-bodies-template-inst.cpp:18:9: warning: using the result of an assignment as a condition without parentheses21  return impl();22}23 24void foo() {25  []() {26    make_func<int>();27    m28    // CHECK: COMPLETION: make_func : [#auto#]make_func<<#class T#>>()29  };30}31