[LLVMbugs] [Bug 16646] New: clang++ reports substitution failure with incorrect argument list

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 17 10:22:08 PDT 2013


            Bug ID: 16646
           Summary: clang++ reports substitution failure with incorrect
                    argument list
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sandipan.mohanty at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code produces a "substitution failure" in clang++ trunk, although
it seems ok and works as expected in GCC.

---- begin example code ---
#include <iostream>
#include <tuple>

template <typename T> struct DefaultValue { const T value=0;};
template <> struct DefaultValue<std::string> { const std::string

template <typename ... Args>
using Zero = std::tuple<DefaultValue<Args> ...>;

template <typename ... Args>
void f(const Zero<Args ...> &t)
    std::cout << sizeof...(Args) << std::endl;

int main()
    Zero<int,double,double> T;
    // f<int,double,double>(T); // This works
---- end example code ---
The compiler error is :

v1.cc:19:5: error: no matching function for call to 'blaha'
v1.cc:11:6: note: candidate template ignored: substitution failure [with Args =
void f(const Zero<Args ...> &t)
1 error generated.

Note the "with Args =<int>" part. When I call f with T, Args should be inferred
as <int, double, double>. Shouldn't it ?

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/20130717/f3d3be48/attachment.html>

More information about the llvm-bugs mailing list