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
4 changes: 2 additions & 2 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2555,10 +2555,10 @@ APValue *VarDecl::evaluateValueImpl(SmallVectorImpl<PartialDiagnosticAt> &Notes,
bool Result = Init->EvaluateAsInitializer(Eval->Evaluated, Ctx, this, Notes,
IsConstantInitialization);

// In C++11, this isn't a constant initializer if we produced notes. In that
// In C++, this isn't a constant initializer if we produced notes. In that
// case, we can't keep the result, because it may only be correct under the
// assumption that the initializer is a constant context.
if (IsConstantInitialization && Ctx.getLangOpts().CPlusPlus11 &&
if (IsConstantInitialization && Ctx.getLangOpts().CPlusPlus &&
!Notes.empty())
Result = false;

Expand Down
5 changes: 5 additions & 0 deletions clang/test/SemaCXX/constant-expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,8 @@ namespace PR31701 {
const C c = C::n<i>;
}
}

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