brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 9b62a22 Raw
66 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -fcxx-exceptions -std=c++17 %s2// expected-no-diagnostics3 4//PR94635int subfun(const char *text) {6  const char *tmp = text;7  return 0;8}9 10void fun(const char* text) {11  int count = 0;12  bool check = true;13 14  if (check)15    {16      const char *end = text;17 18      if (check)19        {20          do21            {22              if (check)23                {24                  count = subfun(end);25                  goto end;26                }27 28              check = !check;29            }30          while (check);31        }32      // also works, after commenting following line of source code33      int e = subfun(end);34    }35 end:36  if (check)37    ++count;38}39 40const char *text = "some text";41 42int main() {43	const char *ptr = text;44 45	fun(ptr);46 47	return 0;48}49 50void asm_goto_try_catch() {51  try {52    __label__ label;53    asm goto("" : : : : label);54    label:;55  } catch(...) {56    __label__ label;57    asm goto("" : : : : label);58    label:;59  };60  if constexpr(false) {61    __label__ label;62    asm goto("" : : : : label);63    label:;64  }65}66