Rafael Espindola | c4b1aea | 2013-10-04 14:33:42 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -std=c++11 -emit-llvm-only |
Nico Weber | eac5003 | 2015-01-07 18:23:08 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -emit-obj -o %t -gline-tables-only -O2 -std=c++11 %s |
Rafael Espindola | c4b1aea | 2013-10-04 14:33:42 +0000 | [diff] [blame] | 3 | // CHECK that we don't crash. |
| 4 | |
| 5 | // PR11676's example is ill-formed: |
| 6 | /* |
| 7 | union _XEvent { |
| 8 | }; |
| 9 | void ProcessEvent() { |
| 10 | _XEvent pluginEvent = _XEvent(); |
| 11 | } |
| 12 | */ |
| 13 | |
| 14 | // Example from PR11665: |
| 15 | void f() { |
| 16 | union U { int field; } u = U(); |
| 17 | (void)U().field; |
| 18 | } |
| 19 | |
| 20 | namespace PR17476 { |
| 21 | struct string { |
| 22 | string(const char *__s); |
| 23 | string &operator+=(const string &__str); |
| 24 | }; |
| 25 | |
| 26 | template <class ELFT> void finalizeDefaultAtomValues() { |
| 27 | auto startEnd = [&](const char * sym)->void { |
| 28 | string start("__"); |
| 29 | start += sym; |
| 30 | } |
| 31 | ; |
| 32 | startEnd("preinit_array"); |
| 33 | } |
| 34 | |
| 35 | void f() { finalizeDefaultAtomValues<int>(); } |
| 36 | } |
Nico Weber | eac5003 | 2015-01-07 18:23:08 +0000 | [diff] [blame] | 37 | |
| 38 | namespace PR22096 { |
| 39 | class _String_val { |
| 40 | union _Bxty { int i; } _Bx; |
| 41 | }; |
| 42 | struct string : public _String_val { |
| 43 | string(const char *_Ptr) : _String_val() {} |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | int ConvertIPv4NumberToIPv6Number(int); |
| 48 | struct IPEndPoint { |
| 49 | IPEndPoint(); |
| 50 | IPEndPoint(const int &address, int port); |
| 51 | const int &address() const {} |
| 52 | }; |
| 53 | |
| 54 | struct SourceAddressTokenTest { |
| 55 | SourceAddressTokenTest() |
| 56 | : ip4_dual_(ConvertIPv4NumberToIPv6Number(ip4_.address()), 1) {} |
| 57 | const string kPrimary = "<primary>"; |
| 58 | IPEndPoint ip4_; |
| 59 | IPEndPoint ip4_dual_; |
| 60 | } s; |
| 61 | } |