1 // bindgen-flags: --enable-cxx-namespaces -- -std=c++11 2 3 // `Wrapper::sentry` and `sentry` should be emitted as `Wrapper_sentry` and 4 // `sentry` respectively, but instead `Wrapper::sentry` is named just `sentry` 5 // which leads to compilation errors. 6 // 7 // Note: if there is no namespace, then we don't run into problems. Similarly, 8 // making the `Wrapper::sentry` definition inline in `Wrapper`, rather than 9 // declared inline with an out of line definition, makes the problem go away as 10 // well. 11 12 namespace whatever { 13 template <typename, typename> 14 class Wrapper { 15 // Declaration of Wrapper::sentry 16 class sentry; 17 }; 18 19 // Definition of Wrapper::sentry 20 template <typename f, typename h> 21 class Wrapper<f, h>::sentry { 22 int i_am_wrapper_sentry; 23 }; 24 25 class sentry { 26 bool i_am_plain_sentry; 27 }; 28 29 // Ok, that was the original bug report. While we're here, let's just try 30 // lots of different things that could go wrong and make sure we handle them 31 // right. 32 33 class NotTemplateWrapper { 34 class sentry; 35 }; 36 37 class NotTemplateWrapper::sentry { 38 char i_am_not_template_wrapper_sentry; 39 }; 40 41 class InlineNotTemplateWrapper { 42 class sentry { 43 bool i_am_inline_not_template_wrapper_sentry; 44 }; 45 }; 46 47 template <typename, typename> 48 class InlineTemplateWrapper { 49 class sentry { 50 int i_am_inline_template_wrapper_sentry; 51 }; 52 }; 53 54 class OuterDoubleWrapper { 55 class InnerDoubleWrapper { 56 class sentry; 57 }; 58 }; 59 60 class OuterDoubleWrapper::InnerDoubleWrapper::sentry { 61 int i_am_double_wrapper_sentry; 62 }; 63 64 class OuterDoubleInlineWrapper { 65 class InnerDoubleInlineWrapper { 66 class sentry { 67 int i_am_double_wrapper_inline_sentry; 68 }; 69 }; 70 }; 71 } 72 73 template <typename, typename> 74 class OutsideNamespaceWrapper { 75 class sentry; 76 }; 77 78 template <typename f, typename h> 79 class OutsideNamespaceWrapper<f, h>::sentry { 80 int i_am_outside_namespace_wrapper_sentry; 81 }; 82 83 class sentry { 84 int i_am_outside_namespace_sentry; 85 }; 86