mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-01 20:21:12 +08:00
re PR c++/30852 (Trouble with __builtin_offsetof and volatile)
PR c++/30852 * c-common.c (fold_offsetof_1): Handle COMPOUND_EXPR. * semantics.c (finish_offsetof): Handle COMPOUND_EXPR. * g++.dg/ext/offsetof1.C: Add cases with volatile. From-SVN: r122686
This commit is contained in:
parent
cc891727f0
commit
1916c916ca
@ -1,3 +1,8 @@
|
||||
2007-03-08 Volker Reichelt <reichelt@netcologne.de>
|
||||
|
||||
PR c++/30852
|
||||
* c-common.c (fold_offsetof_1): Handle COMPOUND_EXPR.
|
||||
|
||||
2007-03-08 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* c-decl.c (grokdeclarator): Disable warnings for anonymous
|
||||
|
@ -6443,6 +6443,12 @@ fold_offsetof_1 (tree expr, tree stop_ref)
|
||||
off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
|
||||
break;
|
||||
|
||||
case COMPOUND_EXPR:
|
||||
/* Handle static members of volatile structs. */
|
||||
t = TREE_OPERAND (expr, 1);
|
||||
gcc_assert (TREE_CODE (t) == VAR_DECL);
|
||||
return fold_offsetof_1 (t, stop_ref);
|
||||
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
2007-03-08 Volker Reichelt <reichelt@netcologne.de>
|
||||
|
||||
PR c++/30852
|
||||
* semantics.c (finish_offsetof): Handle COMPOUND_EXPR.
|
||||
|
||||
PR c++/30534
|
||||
* pt.c (any_template_arguments_need_structural_equality_p):
|
||||
Robustify.
|
||||
|
@ -2933,7 +2933,8 @@ finish_offsetof (tree expr)
|
||||
|| TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE
|
||||
|| TREE_CODE (TREE_TYPE (expr)) == UNKNOWN_TYPE)
|
||||
{
|
||||
if (TREE_CODE (expr) == COMPONENT_REF)
|
||||
if (TREE_CODE (expr) == COMPONENT_REF
|
||||
|| TREE_CODE (expr) == COMPOUND_EXPR)
|
||||
expr = TREE_OPERAND (expr, 1);
|
||||
error ("cannot apply %<offsetof%> to member function %qD", expr);
|
||||
return error_mark_node;
|
||||
|
@ -1,5 +1,8 @@
|
||||
2007-03-08 Volker Reichelt <reichelt@netcologne.de>
|
||||
|
||||
PR c++/30852
|
||||
* g++.dg/ext/offsetof1.C: Add cases with volatile.
|
||||
|
||||
PR c++/30534
|
||||
* g++.dg/template/arg5.C: New test.
|
||||
|
||||
|
@ -8,8 +8,10 @@ struct bar {
|
||||
};
|
||||
|
||||
int a = __builtin_offsetof(bar, foo); // { dg-error "static data member" }
|
||||
int av = __builtin_offsetof(volatile bar, foo); // { dg-error "static data member" }
|
||||
int b = __builtin_offsetof(bar, baz); // { dg-error "member function" }
|
||||
int b0 = __builtin_offsetof(bar, baz[0]); // { dg-error "function" }
|
||||
int bv0 = __builtin_offsetof(volatile bar, baz[0]); // { dg-error "function" }
|
||||
int c = __builtin_offsetof(bar, ~bar); // { dg-error "member function" }
|
||||
|
||||
typedef int I;
|
||||
|
Loading…
x
Reference in New Issue
Block a user