Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5738,9 +5738,17 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
// We should already have a pointer when we get here.
return this->delegate(SubExpr);
case UO_Deref: // *x
if (DiscardResult)
if (DiscardResult) {
// assert(false);
return this->discard(SubExpr);
return this->visit(SubExpr);
}

if (!this->visit(SubExpr))
return false;
if (classifyPrim(SubExpr) == PT_Ptr)
return this->emitNarrowPtr(E);
return true;

case UO_Not: // ~x
if (!T)
return this->emitError(E);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ByteCode/Pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ std::optional<APValue> Pointer::toRValue(const Context &Ctx,

// Return the composite type.
APValue Result;
if (!Composite(getType(), *this, Result))
if (!Composite(ResultType, *this, Result))
return std::nullopt;
return Result;
}
Expand Down
5 changes: 5 additions & 0 deletions clang/test/AST/ByteCode/cxx98.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ _Static_assert(a == 0, ""); // both-error {{static assertion expression is not a
struct SelfReference { SelfReference &r; };
extern SelfReference self_reference_1;
SelfReference self_reference_2 = {self_reference_1};

struct PR65784s{
int *ptr;
} const PR65784[] = {(int *)""};
PR65784s PR65784f() { return *PR65784; }
Loading