http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51556
Bug #: 51556 Summary: Bizarre member template protection errors Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: l...@mit.edu Created attachment 26086 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26086 Failing test I'm not really sure what's going on here, so this test case isn't very well reduced. multiindex_success.cc compiles (as IMO it should). multiindex_failure.cc fails to compile (which is IMO wrong) with this error: /usr/include/boost/multi_index/detail/index_base.hpp: In member function ‘void A::Test2(const Irrelevant&) [with Irrelevant = int]’: /usr/include/boost/multi_index/detail/index_base.hpp:49:44: error: ‘typedef struct boost::multi_index::detail::index_node_base<Entry, std::allocator<Entry> > boost::multi_index::detail::index_base<Entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::tag<A::ById>, boost::multi_index::member<Entry, int, &Entry::id> > >, std::allocator<Entry> >::node_type’ is protected multiindex_failure.cc:42:11: error: within this context The error is garbage, since there is no reference to node_type in that context. The two test cases are identical except that I've reversed the order of two member functions. Preprocessed source attached, because I haven't yet reproduced this without using boost libraries. Seen on g++ (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) and an old-ish 4.7 trunk build.