File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -5145,7 +5145,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5145
5145
// We should already have a pointer when we get here.
5146
5146
return this ->delegate (SubExpr);
5147
5147
case UO_Deref: // *x
5148
- if (DiscardResult)
5148
+ if (DiscardResult || E-> getType ()-> isVoidType () )
5149
5149
return this ->discard (SubExpr);
5150
5150
return this ->visit (SubExpr);
5151
5151
case UO_Not: // ~x
Original file line number Diff line number Diff line change 1
- // RUN: %clang_cc1 -fcxx-exceptions -std=c++20 -fexperimental-new-constant-interpreter -verify %s
2
- // RUN: %clang_cc1 -fcxx-exceptions -std=c++20 -verify=ref %s
1
+ // RUN: %clang_cc1 -fcxx-exceptions -std=c++20 -fexperimental-new-constant-interpreter -verify=expected,both %s
2
+ // RUN: %clang_cc1 -fcxx-exceptions -std=c++20 -verify=ref,both %s
3
3
4
4
namespace Throw {
5
5
@@ -65,4 +65,9 @@ namespace Casts {
65
65
// ref-error {{must be initialized by a constant expression}} \
66
66
// ref-note {{reinterpret_cast is not allowed}}
67
67
68
+ void func () {
69
+ struct B {};
70
+ B b;
71
+ (void )*reinterpret_cast <void *>(&b); // both-error {{indirection not permitted on operand of type 'void *'}}
72
+ }
68
73
}
You can’t perform that action at this time.
0 commit comments