http://llvm.org/bugs/show_bug.cgi?id=16646

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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
value="Uninitialized";};

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(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'
    blaha(T);
    ^~~~~
v1.cc:11:6: note: candidate template ignored: substitution failure [with Args =
<int>]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to