Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only %s |
Douglas Gregor | 119b0c7 | 2009-09-04 05:53:02 +0000 | [diff] [blame] | 2 | |
Douglas Gregor | 01e09d9 | 2010-04-08 18:16:15 +0000 | [diff] [blame] | 3 | // This is a test for an egregious hack in Clang that works around |
| 4 | // issues with GCC's evolution. libstdc++ 4.2.x uses __is_pod as an |
| 5 | // identifier (to declare a struct template like the one below), while |
| 6 | // GCC 4.3 and newer make __is_pod a keyword. Clang treats __is_pod as |
| 7 | // a keyword *unless* it is introduced following the struct keyword. |
| 8 | |
Douglas Gregor | 119b0c7 | 2009-09-04 05:53:02 +0000 | [diff] [blame] | 9 | template<typename T> |
| 10 | struct __is_pod { |
| 11 | }; |
| 12 | |
| 13 | __is_pod<int> ipi; |
Douglas Gregor | 0687309 | 2011-04-28 15:48:45 +0000 | [diff] [blame] | 14 | |
Douglas Gregor | 63180b1 | 2011-04-29 01:38:03 +0000 | [diff] [blame] | 15 | // Ditto for __is_same. |
| 16 | template<typename T> |
| 17 | struct __is_same { |
| 18 | }; |
| 19 | |
Douglas Gregor | f8e894a | 2011-04-29 01:50:40 +0000 | [diff] [blame] | 20 | __is_same<int> isi; |
Douglas Gregor | 63180b1 | 2011-04-29 01:38:03 +0000 | [diff] [blame] | 21 | |
Douglas Gregor | 0687309 | 2011-04-28 15:48:45 +0000 | [diff] [blame] | 22 | // Another, similar egregious hack for __is_signed, which is a type |
| 23 | // trait in Embarcadero's compiler but is used as an identifier in |
| 24 | // libstdc++. |
| 25 | struct test_is_signed { |
| 26 | static const bool __is_signed = true; |
| 27 | }; |
| 28 | |
| 29 | bool check_signed = test_is_signed::__is_signed; |