http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59703
Bug ID: 59703 Summary: using declaration in class mishandles type aliases Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pab at pabigot dot com The code below generates this diagnostic with gcc 4.8.2 and 4.9.0: llc[127]$ /usr/local/gcc/bin/g++ -std=c++11 -c using.cc using.cc:21:30: error: ‘string_type’ is not a class, namespace, or enumeration using size_type = typename string_type::size_type; ^ using.cc:23:3: error: ‘size_type’ does not name a type size_type big () const { ^ using.cc: In function ‘size_t checkit()’: using.cc:31:12: error: ‘class derived<std::basic_string<char> >’ has no member named ‘big’ return x.big(); ^ The code is accepted by clang++ 3.4, and I can find nothing in the standard that indicates it's incorrect. The functionally similar type alias works. #include <string> template <typename S> class base { public: using string_type = S; }; template <typename S> class derived : public base<S> { using super_ = base<S>; public: #if 0 /* These work */ //using string_type = S; using string_type = typename super_::string_type; #else /* This does not work */ using typename super_::string_type; #endif using size_type = typename string_type::size_type; size_type big () const { return string_type::npos; } }; size_t checkit () { derived<std::string> x; return x.big(); }