]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
semantics.c (trait_expr_value, [...]): Implement the letter of 20.11.6 about Base...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 7 Jan 2014 09:40:28 +0000 (09:40 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 7 Jan 2014 09:40:28 +0000 (09:40 +0000)
/cp
2014-01-07  Paolo Carlini  <paolo.carlini@oracle.com>

* 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  <paolo.carlini@oracle.com>

* g++.dg/ext/is_base_of_incomplete-2.C: New.

From-SVN: r206386

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/is_base_of_incomplete-2.C [new file with mode: 0644]

index 99657a9f6d00e704c863c569325d8bd7ad75bff9..b31014fcc752ab2e55f8105fb69cc3584bd36f40 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * 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  <adam@jessamine.co.uk>
 
        PR c++/59635
index 0bb64c7752b5713d0a176c17777c422d18bef317..9f878874e6d71e44434a34f2839f9585b8d82bd3 100644 (file)
@@ -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));
index 1ad3731e38c891fded55951f76a8d1b2dd55633d..a8910bbe26cade4a4a26f8a4701ea6613026f1f9 100644 (file)
@@ -1,3 +1,7 @@
+2014-01-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/ext/is_base_of_incomplete-2.C: New.
+
 2014-01-07  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..5486258
--- /dev/null
@@ -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];