http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60767

            Bug ID: 60767
           Summary: [ICE] [c++11] [4.8.2] use of "using" inside template
                    causes failure in retreive_specialization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zreed1 at gmail dot com

The follow code fails on g++4.8.2, but compiles successfully with clang.

=========================================================================
template <typename _T, int _N>
  struct Impl;

template <typename _T>
  struct Impl<_T,0>
{};

template < typename _Tag, typename _T>
  typename _Tag::template impl< _T > get_impl();

template <int _N>
  struct Tag 
{
  template <typename _T>
    using impl = Impl<_T,_N>;
};

int main()
{ 
  get_impl< Tag<0>, void >();
}

=========================================================================

test.cpp: In substitution of ‘template<class _T> using impl = Impl<_T, 0> [with
_T = 0]’:                                                                     
│  ~                                                                            
test.cpp:9:38:   required by substitution of ‘template<class _Tag, class _T>
typename _Tag::impl<_T> get_impl() [with _Tag = Tag<0>; _T = void]’            
  │  ~                                                                          
test.cpp:22:28:   required from here                                           
                                                                              
│  ~                                                                            
test.cpp:16:29: internal compiler error: in retrieve_specialization, at
cp/pt.c:1021                                                                   
       │  ~                                                                     
     using impl = Impl<_T,_N>;             


=========================================================================

the following similar code compiles successfuly 


=========================================================================
template <typename _T, int _N>
  struct Impl;

template <typename _T>
  struct Impl<_T,0>
{};

template < typename _Tag, typename _T>
  typename _Tag::template impl< _T >::type get_impl();

template <int _N>
  struct Tag 
{
  template <typename _T>
    struct impl
  { typedef Impl<_T,_N> type; };
};

int main()
{

  get_impl< Tag<0>, void >();

}

Reply via email to