PR C++/58708 - string literal operator templates broken
Jakub Jelinek
jakub@redhat.com
Fri Oct 25 15:36:00 GMT 2013
On Fri, Oct 25, 2013 at 10:29:41AM -0400, Ed Smith-Rowland wrote:
> 2013-10-25 Edward Smith-Rowland <3dw4rd@verizon.net>
>
> PR c++/58708
> * parser.c (make_string_pack): Discover non-const type and size
> of character and build parm pack with correct type and chars.
>
> gcc/testsuite:
>
> 2013-10-25 Edward Smith-Rowland <3dw4rd@verizon.net>
>
> PR c++/58708
> *g++.dg/cpp1y/pr58708.C : New.
> --- testsuite/g++.dg/cpp1y/pr58708.C (revision 0)
> +++ testsuite/g++.dg/cpp1y/pr58708.C (working copy)
> @@ -0,0 +1,91 @@
> +// { dg-options -std=c++1y }
> +// { dg-do run }
> +
> +template<typename _Tp, _Tp __v>
> + struct integral_constant
> + {
> + static constexpr _Tp value = __v;
> + typedef _Tp value_type;
> + typedef integral_constant<_Tp, __v> type;
> + constexpr operator value_type() const { return value; }
> + constexpr value_type operator()() const { return value; }
> + };
> +
> +template<typename _Tp, _Tp __v>
> + constexpr _Tp integral_constant<_Tp, __v>::value;
> +
> +typedef integral_constant<bool, true> true_type;
> +
> +typedef integral_constant<bool, false> false_type;
> +
> +template<typename, typename>
> + struct is_same
> + : public false_type { };
> +
> +template<typename _Tp>
> + struct is_same<_Tp, _Tp>
> + : public true_type { };
Why not just the minimal:
template< class T, class U >
struct is_same {
static constexpr bool value = false;
};
template< class T >
struct is_same<T, T> {
static constexpr bool value = true;
};
other tests are using?
Jakub
More information about the Gcc-patches
mailing list