[LLVMbugs] [Bug 16288] New: Deduced template parameter after defaulted template parameter not working for static class member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 9 23:22:31 PDT 2013


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

            Bug ID: 16288
           Summary: Deduced template parameter after defaulted template
                    parameter not working for static class member
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vince.rev at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following example :

----------------------------------------
#include <iostream>
#include <tuple>

template <class Type>
struct Getter
{
    template <unsigned int Index = 0, class Tuple>
    static inline Type get(const Tuple& tuple);
};

template <class Type>
template <unsigned int Index, class Tuple>
inline Type Getter<Type>::get(const Tuple& tuple)
{
    return std::get<Index>(tuple);
}

int main(int argc, char* argv[])
{
    std::cout<<Getter<int>::get(std::make_tuple(42))<<std::endl;
    return 0;
}
----------------------------------------

Under "clang++ 3.2-1~exp9ubuntu1", it produces the following error :
----------------------------------------
defaulttemplate.cpp:12:37: error: template parameter missing a default argument
template <unsigned int Index, class Tuple>
                                    ^
defaulttemplate.cpp:7:36: note: previous default template argument defined here
    template <unsigned int Index = 0, class Tuple>
----------------------------------------

If the member is defined inside the class declaration, clang++ does not
complain anymore.

-- 
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/20130610/ab252a25/attachment.html>


More information about the llvm-bugs mailing list