clang/test/SemaCXX/try-print-as-string-literal-type-check.cpp
raw| 1 | // RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | // Reported by: https://github.com/llvm/llvm-project/issues/57013 |
| 5 | // The following code should not crash clang |
| 6 | struct X { |
| 7 | char arr[2]; |
| 8 | constexpr X() {} |
| 9 | constexpr void modify() { |
| 10 | arr[0] = 0; |
| 11 | } |
| 12 | }; |
| 13 | constexpr X f(X t) { |
| 14 | t.modify(); |
| 15 | return t; |
| 16 | } |
| 17 | auto x = f(X()); |