[LLVMbugs] [Bug 16503] New: clang is wrongly compiled varadic templates, or sizeof ...(T) construction.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 30 23:14:54 PDT 2013


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

            Bug ID: 16503
           Summary: clang is wrongly compiled  varadic templates, or
                    sizeof ...(T) construction.
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: khurshid.normuradov at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I compiled following programm, it's success compiled, but wrongly printed
result. I've tested it with GCC 4.8.0 also, it shows right result, but with
CLang 3.2 results is wrongly.

results for
GCC 4.8.0 :  3 4
CLang 3.2 :  3 1


//////////////////////////////////////////
/// source code /////////////////////////
#include <iostream>
#include <type_traits>

template<class T>
void writeln(T const& t){   std::cout << t << std::endl; }

namespace vargs
{
template< class ...T>
using size_of = std::integral_constant< decltype(sizeof...(T)), (sizeof...(T)
)>;
}


namespace mpl
{
    template<class ...T>
    struct tuple
    {
        using type = tuple;
    };

    template< class TP> struct size_of;

    template< class ...T> struct size_of< tuple<T...> > : vargs::size_of<T...>
{};
}

int main(int argc, char * argv[])
{
    auto n = vargs::size_of<int,float,double>::value;

    writeln(n);

    typedef mpl::tuple<int,float,double,char> mytuple;

    auto s = mpl::size_of<mytuple>::value;

    writeln(s);
}
//////////////////////////////////////////////////////////////////////

-- 
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/20130701/2e4e1faf/attachment.html>


More information about the llvm-bugs mailing list