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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs