mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-21 08:40:30 +08:00
re PR c++/51299 ([C++11] erroneous nullptr warning on dynamic cast)
/cp 2011-11-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51299 * rtti.c (ifnonnull): Use nullptr_node. (build_dynamic_cast_1): Call cp_truthvalue_conversion instead of c_common_truthvalue_conversion. /testsuite 2011-11-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51299 * g++.dg/warn/Wzero-as-null-pointer-constant-4.C: New. From-SVN: r181854
This commit is contained in:
parent
2e65f38f1b
commit
23ffb99e94
@ -1,3 +1,10 @@
|
||||
2011-11-30 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51299
|
||||
* rtti.c (ifnonnull): Use nullptr_node.
|
||||
(build_dynamic_cast_1): Call cp_truthvalue_conversion instead
|
||||
of c_common_truthvalue_conversion.
|
||||
|
||||
2011-11-24 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51227
|
||||
|
@ -503,8 +503,8 @@ ifnonnull (tree test, tree result)
|
||||
{
|
||||
return build3 (COND_EXPR, TREE_TYPE (result),
|
||||
build2 (EQ_EXPR, boolean_type_node, test,
|
||||
cp_convert (TREE_TYPE (test), integer_zero_node)),
|
||||
cp_convert (TREE_TYPE (result), integer_zero_node),
|
||||
cp_convert (TREE_TYPE (test), nullptr_node)),
|
||||
cp_convert (TREE_TYPE (result), nullptr_node),
|
||||
result);
|
||||
}
|
||||
|
||||
@ -747,7 +747,7 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
|
||||
tree neq;
|
||||
|
||||
result = save_expr (result);
|
||||
neq = c_common_truthvalue_conversion (input_location, result);
|
||||
neq = cp_truthvalue_conversion (result);
|
||||
return cp_convert (type,
|
||||
build3 (COND_EXPR, TREE_TYPE (result),
|
||||
neq, result, bad));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2011-11-30 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51299
|
||||
* g++.dg/warn/Wzero-as-null-pointer-constant-4.C: New.
|
||||
|
||||
2011-11-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/51247
|
||||
|
22
gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-4.C
Normal file
22
gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-4.C
Normal file
@ -0,0 +1,22 @@
|
||||
// PR c++/51299
|
||||
// { dg-options "-Wzero-as-null-pointer-constant" }
|
||||
|
||||
class Base
|
||||
{
|
||||
public:
|
||||
virtual ~Base();
|
||||
};
|
||||
|
||||
class Derived : public Base
|
||||
{
|
||||
};
|
||||
|
||||
void foo(Base* b)
|
||||
{
|
||||
Derived* d = dynamic_cast<Derived*>(b);
|
||||
}
|
||||
|
||||
void bar(Base& b)
|
||||
{
|
||||
Derived& d = dynamic_cast<Derived&>(b);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user