aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-08-23 12:47:24 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-08-23 12:47:24 +0000
commit03d0f4af2d5607dacc56b946b49e024e71dd7fb7 (patch)
tree1a569fd48a34a3e468b6fe1fcacbc60c724d1626 /gcc/cp/cvt.c
parent5d7045be13252dfa6c183863cbe1a3335d34fec5 (diff)
downloadgcc-03d0f4af2d5607dacc56b946b49e024e71dd7fb7.zip
gcc-03d0f4af2d5607dacc56b946b49e024e71dd7fb7.tar.gz
gcc-03d0f4af2d5607dacc56b946b49e024e71dd7fb7.tar.bz2
iomanip.h: Use __extension__ for `extern' explicit template instantiations.
* iomanip.h: Use __extension__ for `extern' explicit template instantiations. * sinst.cc: Don't explicitly instantiation string_char_traits<char>. * cinst.cc: Likewiwse, for complex<float>, complex<double>, complex<long double>. * extend.texi: Remove description of extension to explicit instantiation that is now endorsed by standard C++. * decl2.c (grok_array_decl): Add comment. (mark_used): Don't instantiate an explicit instantiation. * friend.c (make_friend_class): Remove bogus comment. Fix check for partial specializations. * pt.c (check_explicit_specialization): Don't SET_DECL_EXPLICIT_INSTANTIATION here. (mark_decl_instantiated): Or here. (do_decl_instantiation): Do it here, instead. Add checks for duplicate explicit instantiations, etc. Tidy. (do_type_instantiation): Likewise. (instantiate_decl): Improve comments. Complain about explicit instantiations where no definition is available. * cp-tree.h (ansi_null_node): Remove. * call.c (build_over_call): Warn about converting NULL to an arithmetic type. * cvt.c (build_expr_type_conversion): Likewise. Use null_ptr_cst_p instead of expanding it inline. * decl.c (ansi_null_node): Remove. (init_decl_processing): Make null_node always have integral type. * except.c (build_throw): Warn about converting NULL to an arithmetic type. * lex.c (init_parse): Remove handling of ansi_null_node. * pt.c (type_unification_real): Don't convert NULL to void* type. * typeck.c (build_binary_op_nodefault): Fix NULL warnings. (convert_for_assignment): Warn about converting NULL to an arithmetic type. (convert_for_initialization): Likewise. From-SVN: r21915
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 1c6447a..99289e8 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -946,6 +946,11 @@ build_expr_type_conversion (desires, expr, complain)
tree conv;
tree winner = NULL_TREE;
+ if (expr == null_node
+ && (desires & WANT_INT)
+ && !(desires & WANT_NULL))
+ cp_warning ("converting NULL to non-pointer type");
+
if (TREE_CODE (basetype) == OFFSET_TYPE)
expr = resolve_offset_ref (expr);
expr = convert_from_reference (expr);
@@ -955,8 +960,7 @@ build_expr_type_conversion (desires, expr, complain)
switch (TREE_CODE (basetype))
{
case INTEGER_TYPE:
- if ((desires & WANT_NULL) && TREE_CODE (expr) == INTEGER_CST
- && integer_zerop (expr))
+ if ((desires & WANT_NULL) && null_ptr_cst_p (expr))
return expr;
/* else fall through... */