[LLVMbugs] [Bug 20698] New: Erroneous "too many template arguments for class template" (via template template)?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 18 10:17:09 PDT 2014


            Bug ID: 20698
           Summary: Erroneous "too many template arguments for class
                    template" (via template template)?
           Product: clang
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zerolo at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12914
  --> http://llvm.org/bugs/attachment.cgi?id=12914&action=edit
Repo failing using -std=c++11

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

The attached repo (which compiles fine with g++ 4.8.1) should be valid IMO, but
instead clang complains about 
> clang++ --std=c++11 clang_repo.cpp 
clang_repo.cpp:21:6: error: no matching member function for call to 'Get'
  t2.Get<1>(); // not ok
clang_repo.cpp:7:18: note: candidate template ignored: substitution failure
[with Is = <1>]: too many template arguments for class template 'Foo'
  Inner<Is ...> &Get()
  ~~~~~          ^
1 error generated.

but the number of template arguments seem to be correct (i.e. one).

I've reduced this down from a case where the Inner-template was variadic, but
this doesn't seem to be the cause.
Making the Get-method non-variadic makes the error go away, but as the
Inner-template is supposed to be variadic, I can't really do that.

template<template<int> class Inner>
struct Test
  // works if Is is not variadic
  template<int ...Is>
  Inner<Is ...> &Get()
    static Inner<Is ...> a;
    return a;

template<int A>
struct Foo { };

int main (int argc, char const *argv[])
  Foo<1> f; // ok
  Test<Foo> t2; // ok
  t2.Get<1>(); // not ok
  return 0;

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140818/68bf3c1b/attachment.html>

More information about the llvm-bugs mailing list