This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR C++/58708 - string literal operator templates broken


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]