re PR c++/85033 (internal compiler error: in fold_offsetof_1, at c-family/c-common.c:6269)
PR c++/85033 * semantics.c (finish_offsetof): Don't allow CONST_DECLs. * g++.dg/ext/builtin-offsetof2.C: New test. From-SVN: r258801
This commit is contained in:
parent
f300628bfb
commit
b01556f72a
4 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2018-03-23 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/85033
|
||||
* semantics.c (finish_offsetof): Don't allow CONST_DECLs.
|
||||
|
||||
2018-03-23 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR c++/71251
|
||||
|
|
|
@ -4072,6 +4072,11 @@ finish_offsetof (tree object_ptr, tree expr, location_t loc)
|
|||
}
|
||||
return error_mark_node;
|
||||
}
|
||||
if (TREE_CODE (expr) == CONST_DECL)
|
||||
{
|
||||
error ("cannot apply %<offsetof%> to an enumerator %qD", expr);
|
||||
return error_mark_node;
|
||||
}
|
||||
if (REFERENCE_REF_P (expr))
|
||||
expr = TREE_OPERAND (expr, 0);
|
||||
if (!complete_type_or_else (TREE_TYPE (TREE_TYPE (object_ptr)), object_ptr))
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2018-03-23 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/85033
|
||||
* g++.dg/ext/builtin-offsetof2.C: New test.
|
||||
|
||||
2018-03-23 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
PR debug/85020
|
||||
|
|
7
gcc/testsuite/g++.dg/ext/builtin-offsetof2.C
Normal file
7
gcc/testsuite/g++.dg/ext/builtin-offsetof2.C
Normal file
|
@ -0,0 +1,7 @@
|
|||
// PR c++/85033
|
||||
|
||||
struct S {
|
||||
enum { E };
|
||||
};
|
||||
|
||||
int b = __builtin_offsetof(S, E); // { dg-error "cannot apply .offsetof. to an enumerator" }
|
Loading…
Add table
Reference in a new issue