diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-29 06:55:03 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-29 06:55:03 +0000 |
commit | dc02da7f70bd7dfc9b7dc176a1ffbe47e9c07830 (patch) | |
tree | d610e5b2cb788508832762326b280dc332edea2e /gcc/cp/cvt.c | |
parent | 0e86cfce7ff7e2c27252114f9e7833c56c7c9c9c (diff) | |
download | gcc-dc02da7f70bd7dfc9b7dc176a1ffbe47e9c07830.tar.gz |
PR c++/26577
* cvt.c (convert_to_void): Don't automatically load from volatiles
of TREE_ADDRESSABLE type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116554 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 902372ea191..710bc74ccde 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -864,14 +864,17 @@ convert_to_void (tree expr, const char *implicit) int is_volatile = TYPE_VOLATILE (type); int is_complete = COMPLETE_TYPE_P (complete_type (type)); + /* Can't load the value if we don't know the type. */ if (is_volatile && !is_complete) warning (0, "object of incomplete type %qT will not be accessed in %s", type, implicit ? implicit : "void context"); - else if (is_reference && is_volatile) + /* Don't load the value if this is an implicit dereference, or if + the type needs to be handled by ctors/dtors. */ + else if (is_volatile && (is_reference || TREE_ADDRESSABLE (type))) warning (0, "object of type %qT will not be accessed in %s", TREE_TYPE (TREE_OPERAND (expr, 0)), implicit ? implicit : "void context"); - if (is_reference || !is_volatile || !is_complete) + if (is_reference || !is_volatile || !is_complete || TREE_ADDRESSABLE (type)) expr = TREE_OPERAND (expr, 0); break; |