Rafael Espindola | c4b1aea | 2013-10-04 14:33:42 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -std=c++11 -emit-llvm-only |
Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -emit-obj -o %t -debug-info-kind=line-tables-only -std=c++11 %s |
Alexey Bataev | 80e1b5e | 2018-08-31 13:56:14 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -emit-obj -o %t -debug-info-kind=line-directives-only -std=c++11 %s |
Rafael Espindola | c4b1aea | 2013-10-04 14:33:42 +0000 | [diff] [blame] | 4 | // CHECK that we don't crash. |
| 5 | |
| 6 | // PR11676's example is ill-formed: |
| 7 | /* |
| 8 | union _XEvent { |
| 9 | }; |
| 10 | void ProcessEvent() { |
| 11 | _XEvent pluginEvent = _XEvent(); |
| 12 | } |
| 13 | */ |
| 14 | |
| 15 | // Example from PR11665: |
| 16 | void f() { |
| 17 | union U { int field; } u = U(); |
| 18 | (void)U().field; |
| 19 | } |
| 20 | |
| 21 | namespace PR17476 { |
| 22 | struct string { |
| 23 | string(const char *__s); |
| 24 | string &operator+=(const string &__str); |
| 25 | }; |
| 26 | |
| 27 | template <class ELFT> void finalizeDefaultAtomValues() { |
| 28 | auto startEnd = [&](const char * sym)->void { |
| 29 | string start("__"); |
| 30 | start += sym; |
| 31 | } |
| 32 | ; |
| 33 | startEnd("preinit_array"); |
| 34 | } |
| 35 | |
| 36 | void f() { finalizeDefaultAtomValues<int>(); } |
| 37 | } |