Commit 5c04da88 by Marek Polacek Committed by Marek Polacek

PR c++/92271 - make __is_same alias for __is_same_as.

Richard Smith proposed adding a synonym for __is_same_as, to accomodate the
convention of exposing std::SOME_TRAIT<A, B>::value as __SOME_TRAIT(A, B).

So add that alias, and also adjust the C++ printer.  I didn't bother changing
the RID_ identifier.

	* c-common.c: Add __is_same, an alias for __is_same_as.

	* cxx-pretty-print.c (pp_cxx_trait_expression) <case CPTK_IS_SAME_AS>:
	Print "__is_same".

	* g++.dg/ext/is_same.C: New test.

From-SVN: r279018
parent 34fbe3f0
2019-12-05 Marek Polacek <polacek@redhat.com>
PR c++/92271 - make __is_same alias for __is_same_as.
* c-common.c: Add __is_same, an alias for __is_same_as.
2019-12-03 Marek Polacek <polacek@redhat.com>
PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
......
......@@ -418,6 +418,7 @@ const struct c_common_resword c_common_reswords[] =
{ "__is_literal_type", RID_IS_LITERAL_TYPE, D_CXXONLY },
{ "__is_pod", RID_IS_POD, D_CXXONLY },
{ "__is_polymorphic", RID_IS_POLYMORPHIC, D_CXXONLY },
{ "__is_same", RID_IS_SAME_AS, D_CXXONLY },
{ "__is_same_as", RID_IS_SAME_AS, D_CXXONLY },
{ "__is_standard_layout", RID_IS_STD_LAYOUT, D_CXXONLY },
{ "__is_trivial", RID_IS_TRIVIAL, D_CXXONLY },
......
2019-12-05 Marek Polacek <polacek@redhat.com>
PR c++/92271 - make __is_same alias for __is_same_as.
* cxx-pretty-print.c (pp_cxx_trait_expression) <case CPTK_IS_SAME_AS>:
Print "__is_same".
2019-12-05 David Edelsohn <dje.gcc@gmail.com>
* cp-gimplify.c: Include memmodel.h.
......
......@@ -2661,7 +2661,7 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
pp_cxx_ws_string (pp, "__is_polymorphic");
break;
case CPTK_IS_SAME_AS:
pp_cxx_ws_string (pp, "__is_same_as");
pp_cxx_ws_string (pp, "__is_same");
break;
case CPTK_IS_STD_LAYOUT:
pp_cxx_ws_string (pp, "__is_std_layout");
......
2019-12-05 Marek Polacek <polacek@redhat.com>
PR c++/92271 - make __is_same alias for __is_same_as.
* g++.dg/ext/is_same.C: New test.
2019-12-05 Tobias Burnus <tobias@codesourcery.com>
* testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Add
......
// PR c++/92271 - make __is_same alias for __is_same_as.
// { dg-do compile { target c++11 } }
static_assert(__is_same(int, int) == __is_same_as(int, int), "");
static_assert(__is_same(unsigned int, int) == __is_same_as(unsigned int, int), "");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment