1 #include <type_traits> 2 3 // this gets included 4 int this_too = 3; 5 6 #ifdef FOOBAR // with a comment 7 // this gets as well 8 enum Yep {}; 9 #else 10 /* this too */ 11 using Yay = int; 12 #endif 13 14 #if defined(__GNUC__) && __GNUC__ > 5 15 // complex expression stays as-is 16 constexpr bool eh = std::is_trivially_constructible<int>::value; 17 #endif 18 19 /* Corner cases for #else */ 20 Yay yay; 21 22 /* Corner cases for #elif */ 23 #ifndef BADTOOTH 24 Yep wow(Yay hah); 25 #elif !defined(FOOBAR) 26 wow(Yay{}); 27 #else 28 auto this_gets_enabled() -> Yay { return {}; } 29 #endif 30 31 #ifdef FOOBAR 32 #define THIS_IS_VISIBLE YAY 33 #else 34 #define THIS_TOO(but, unconditionally) 35 #endif 36 37 /* Nested if/elif should not flip the outer and leak visibility, so nothing 38 gets out */ 39 40 /* Output only the third branch */ 41 // this goes to the output 42 43 /* Appends one more endif */ 44 #ifdef ACME 45 // this gets to the output 46 #else 47 #ifdef FOOBAR 48 // this again 49 #endif 50 #endif 51 52 /* No extraneous endifs */ 53 // yes 54 55 /* Remove both these, since they're empty */ 56 57 /* Don't remove anything here */ 58 #ifdef A 59 #elif defined(B) 60 #endif 61 62 /* Don't remove anything here either */ 63 #ifdef A 64 #else 65 #endif 66 67 /* Parse this correctly (the slash is there) */ 68 #if __has_include(<bits/c++config.h>) /* the __GLIBCXX__ define */ 69 // yay! 70 #endif 71