This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR C++/58708 - string literal operator templates broken
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ed Smith-Rowland <3dw4rd at verizon dot net>
- Cc: Paolo Carlini <paolo dot carlini at oracle dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Fri, 25 Oct 2013 16:40:13 +0200
- Subject: Re: PR C++/58708 - string literal operator templates broken
- Authentication-results: sourceware.org; auth=none
- References: <5260A01F dot 5010701 at verizon dot net> <526A4304 dot 6020800 at oracle dot com> <526A584F dot 4050400 at verizon dot net> <526A5BF3 dot 1040708 at oracle dot com> <526A7618 dot 5030601 at verizon dot net> <526A79C5 dot 8040501 at oracle dot com> <526A8055 dot 6020907 at verizon dot net>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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