[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [LLVMbugs] [Bug 13243] New: Template argument inference problem with template aliases
From: bugzilla-daemon () llvm ! org
Date: 2012-06-30 9:57:23
Message-ID: bug-13243-206 () http ! llvm ! org/bugs/
[Download RAW message or body]
http://llvm.org/bugs/show_bug.cgi?id=13243
Bug #: 13243
Summary: Template argument inference problem with template
aliases
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs@nondot.org
ReportedBy: slavomir.kaslev@gmail.com
CC: dgregor@apple.com, llvmbugs@cs.uiuc.edu
Classification: Unclassified
The following code compiles fine with "#define BUG 0" but errors with "#define
BUG 1".
#include <tuple>
#include <type_traits>
#include <iostream>
#define BUG 1
#if BUG
template <size_t I>
using size_t_ = std::integral_constant<size_t, I>;
#else
template <size_t I> struct size_t_ {};
#endif
template <class Ch, class Traits, class Tuple, size_t I>
void print_tuple(std::basic_ostream<Ch, Traits>& os, Tuple const& t,
size_t_<I>) {
print_tuple(os, t, size_t_<I-1>());
os << ", " << std::get<I>(t);
}
template <class Ch, class Traits, class Tuple>
void print_tuple(std::basic_ostream<Ch, Traits>& os, const Tuple& t,
size_t_<0>) {
os << std::get<0>(t);
}
namespace std {
template <class Ch, class Traits, class... Args>
ostream& operator<<(basic_ostream<Ch, Traits>& os, const tuple<Args...>& t)
{
os << "[";
print_tuple(os, t, size_t_<sizeof...(Args)-1>());
return os << "]";
}
}
int main() {
std::cout << std::make_tuple(3.14, 6.28f, "hey you") << std::endl;
return 0;
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic