Details
- Reviewers
aaron.ballman erichkeane tahonermann shafik
Diff Detail
Event Timeline
clang/test/AST/Interp/records.cpp | ||
---|---|---|
509–512 | I may have jumped the gun on accepting this, actually. Forming the pointer to &b + 1 is fine, but evaluating it by dereferencing it would be UB. e.g., http://eel.is/c++draft/expr.const#13.3 |
clang/test/AST/Interp/records.cpp | ||
---|---|---|
509–512 | We probably want tests that ensure &b+2 is invalid in all cases |
clang/test/AST/Interp/records.cpp | ||
---|---|---|
509–512 | It's being evaluated because the base class is accessed, isn't it? if b was of type A*, we would not emit a diagnostic (see line 506 above). |
clang/test/AST/Interp/records.cpp | ||
---|---|---|
509–512 | I'm not seeing the access to the base class -- we're forming a pointer, not dereferencing it. https://godbolt.org/z/vxThqczeo I think this is an existing Clang bug. CC @hubert.reinterpretcast @rsmith for additional opinions. |
clang/test/AST/Interp/records.cpp | ||
---|---|---|
509–512 | I believe this is fine, or at least i can't find any wording that would say it's not. In particular:
So i do believe GCC, MSVC and ICC are correct here. |
I may have jumped the gun on accepting this, actually. Forming the pointer to &b + 1 is fine, but evaluating it by dereferencing it would be UB. e.g., http://eel.is/c++draft/expr.const#13.3