From 1f872df76202fbf8ffef70c688246847b80cbedb Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 7 Jan 2014 09:40:28 +0000 Subject: semantics.c (trait_expr_value, [...]): Implement the letter of 20.11.6 about Base and Derived naming the same class... /cp 2014-01-07 Paolo Carlini * semantics.c (trait_expr_value, [CPTK_IS_BASE_OF]): Implement the letter of 20.11.6 about Base and Derived naming the same class type modulo cv-qualifiers. /testsuite 2014-01-07 Paolo Carlini * g++.dg/ext/is_base_of_incomplete-2.C: New. From-SVN: r206386 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/ext/is_base_of_incomplete-2.C | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/is_base_of_incomplete-2.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 99657a9..b31014f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-01-07 Paolo Carlini + + * semantics.c (trait_expr_value, [CPTK_IS_BASE_OF]): Implement + the letter of 20.11.6 about Base and Derived naming the same + class type modulo cv-qualifiers. + 2014-01-06 Adam Butcher PR c++/59635 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0bb64c7..9f87887 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7106,7 +7106,8 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_BASE_OF: return (NON_UNION_CLASS_TYPE_P (type1) && NON_UNION_CLASS_TYPE_P (type2) - && DERIVED_FROM_P (type1, type2)); + && (same_type_ignoring_top_level_qualifiers_p (type1, type2) + || DERIVED_FROM_P (type1, type2))); case CPTK_IS_CLASS: return (NON_UNION_CLASS_TYPE_P (type1)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ad3731..a8910bb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-01-07 Paolo Carlini + + * g++.dg/ext/is_base_of_incomplete-2.C: New. + 2014-01-07 Jakub Jelinek PR rtl-optimization/58668 diff --git a/gcc/testsuite/g++.dg/ext/is_base_of_incomplete-2.C b/gcc/testsuite/g++.dg/ext/is_base_of_incomplete-2.C new file mode 100644 index 0000000..5486258 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_base_of_incomplete-2.C @@ -0,0 +1,5 @@ +struct T; + +int check1[__is_base_of(T, T) ? 1 : -1]; +int check2[__is_base_of(T, const T) ? 1 : -1]; +int check3[__is_base_of(volatile T, T) ? 1 : -1]; -- cgit v1.1