This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/59416] New: A nested template reusing the template arguments of the enclosing type in a template template argument not working


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

            Bug ID: 59416
           Summary: A nested template reusing the template arguments of
                    the enclosing type in a template template argument not
                    working
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com

Test:

template<int,int> struct Obj; 
template<typename... Ts> struct A {
  template<template<Ts...> class> struct B { };
};

int main()
{ 
  A<int,int>::B<Obj> x{ }; 
} 

edoceo3.cpp:8:20: error: type/value mismatch at argument 1 in template
parameter list for âtemplate<class ... Ts> template<template<template<Ts
...<anonymous> > class<template-parameter-2-1> > template<class ... Ts>
template<Ts ...<anonymous> > class<template-parameter-2-1> > struct A<Ts>::Bâ
   A<int,int>::B<Obj> x{ }; 
                    ^
edoceo3.cpp:8:20: error:   expected a template of type âtemplate<class ... Ts>
template<Ts ...<anonymous> > class<template-parameter-2-1>â, got âtemplate<int
<anonymous>, int <anonymous> > struct Objâ
edoceo3.cpp:8:23: error: invalid type in declaration before â{â token
   A<int,int>::B<Obj> x{ }; 

clang compiles this code. It certainly looks valid to me, since in the
attempted instantiation, A's template arguments are 'int,int', and then
the template argument for A::B should be 'template <int, int> class',
and Obj is such a template.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]