[cfe-dev] [cfe-users] error: non-type template argument depends on a template parameter of the partial specialization

Richard Smith richard at metafoo.co.uk
Tue Nov 19 15:18:37 PST 2013


Reduced testcase:

template<int A> struct outer {
  template<int B, int C> struct inner {};
  template<int C> struct inner<A * 2, C> {};
};

Yes, this is valid code. Please file a bug!

You can work around this by hiding the non-type template argument in a type
template argument:

template<int N> struct Int { static const int value = N; };

template<int A> struct outer {
  template<typename B, int C> struct inner {};
  template<int C> struct inner<Int<A * 2>, C> {};
};


On Tue, Nov 19, 2013 at 8:31 AM, John Owens <john_owens at yahoo.com> wrote:

> Thanks John, and thanks to Don Hinton who had an offline suggestion to use
> default values for template parameters. We’re happy to take any suggestions
> we can / inspire clang toward handling a few more cases!
>
> JDO
>
> On Nov 19, 2013, at 8:25 AM, Fletcher, John P <j.p.fletcher at aston.ac.uk>
> wrote:
>
> > John
> >
> > I am copying this to the developers list which has a much higher traffic
> and where they are interested in things wrong with clang.
> >
> > John Fletcher
> >
> > -----Original Message-----
> > From: cfe-users-bounces at cs.uiuc.edu [mailto:
> cfe-users-bounces at cs.uiuc.edu] On Behalf Of John Owens
> > Sent: 15 November 2013 22:23
> > To: cfe-users at cs.uiuc.edu
> > Subject: [cfe-users] error: non-type template argument depends on a
> template parameter of the partial specialization
> >
> > Greetings!
> >
> > We're about to release a graph library for GPUs. The library compiles
> fine on, well, everything except clang (I'm using OS X), and it's because
> clang does not support the same template feature set as other compilers.
> ("error: non-type template argument depends on a template parameter of the
> partial specialization")
> >
> > Here's the issue and the reply from Duane Merrill at NVIDIA:
> >
> > https://github.com/gunrock/gunrock/issues/1
> >
> > (I'll append a short version of it below.)
> >
> > What I'd love to know is "is this something that clang will support in
> the near future / is there an easy clang workaround". If neither is true,
> perhaps we do some refactoring, per Duane's suggestion. But if either is
> true, that would ease our support issues.
> >
> > JDO
> >
> >
> > load_tile.cuh:207:
> >
> >        template <int LOAD, int dummy>
> >        struct Iterate<LOAD, LOAD_VEC_SIZE, dummy>
> >
> > The error I'm getting is:
> >
> > ../../gunrock/util/io/load_tile.cuh:207:23: error: non-type template
> argument
> >      depends on a template parameter of the partial specialization
> _______________________________________________
> > cfe-users mailing list
> > cfe-users at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
> >
> >
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131119/c9e4d6ec/attachment.html>


More information about the cfe-dev mailing list