[Bug c++/69958] sizeof... computes wrong size
yanikibo at yandex dot com
gcc-bugzilla@gcc.gnu.org
Fri Feb 26 13:14:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69958
Ibrahim Gokhan YANIKLAR <yanikibo at yandex dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yanikibo at yandex dot com
--- Comment #2 from Ibrahim Gokhan YANIKLAR <yanikibo at yandex dot com> ---
#include <iostream>
template < std::size_t N >
struct A { enum : std::size_t { value = N }; };
template < class... TL >
using B = A< sizeof...(TL) >;
template < class T >
struct C { using type = T; };
template < class... TL >
using D = typename C< B<TL...> >::type;
template < class T, class U, class... TL >
void foo( T, U, TL... )
{
std::cout << (B<T, U, TL...>::value) << std::endl;
std::cout << (D<T, U, TL...>::value) << std::endl;
std::cout << (C< B<T, U, TL...> >::type::value) << std::endl;
}
int main()
{
foo(10, 20, 30, 40, 50);
}
//-----------------------
// output(g++4.7):
//-----------------------
// 3
// 3
// 3
//-----------------------
// output(g++4.8-g++5.3):
//-----------------------
// 5
// 5
// 3
//-----------------------
// output(correct)
//-----------------------
// 5
// 5
// 5
More information about the Gcc-bugs
mailing list