rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.
Committed as r301822.
Comment at: lib/AST/ExprConstant.cpp:1301
void addUnsizedArray(EvalInfo &Info, QualType ElemTy) {
- assert(Designator.Entries.empty() && getTy
Arcoth updated this revision to Diff 97180.
Arcoth added a comment.
Applied the last review's suggestions.
https://reviews.llvm.org/D32372
Files:
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/ExprConstant.cpp
test/SemaCXX/constexpr-array-unknown-bound.cpp
Index: test/SemaCXX/constexp
rsmith added a comment.
Thanks, this looks good, just a couple of minor things and then it should be
ready to land.
Do you have commit access or will you need someone else to commit this for you?
Comment at: lib/AST/ExprConstant.cpp:152
+ uint64_t &A
Arcoth updated this revision to Diff 97116.
Arcoth added a comment.
(Just fixed a slip after typing with the wrong window in focus...)
https://reviews.llvm.org/D32372
Files:
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/ExprConstant.cpp
test/SemaCXX/constexpr-array-unknown-bound.cpp
Arcoth updated this revision to Diff 97114.
Arcoth added a comment.
Simplified array-to-pointer conversion (simply add the array as unsized; let
findCompleteObject and the SubobjectDesignator ctor do the work).
https://reviews.llvm.org/D32372
Files:
include/clang/Basic/DiagnosticASTKinds.td
Arcoth updated this revision to Diff 97105.
Arcoth added a comment.
Updated `SubobjectDesignator` to hold `MostDerivedIsAnUnsizedArray` instead of
`FirstEntryIsAnUnsizedArray`. Consequently, we cannot know whether the first
element is an unsized array; please see line 7352 in particular, where t
rsmith added a comment.
The change in direction from diagnosing the lvalue-to-rvalue conversion to
diagnosing the pointer arithmetic seems fine to me (and is likely a better
approach overall), but this means we should now treat a designator referring to
element 0 of an array of unknown / runtim
Arcoth updated this revision to Diff 96603.
Arcoth added a comment.
Small fix.
https://reviews.llvm.org/D32372
Files:
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/ExprConstant.cpp
test/SemaCXX/constexpr-array-unknown-bound.cpp
Index: test/SemaCXX/constexpr-array-unknown-bound.cpp
==
Arcoth updated this revision to Diff 96594.
Arcoth marked 6 inline comments as done.
Arcoth added a comment.
Adjusted.
Implemented the changes suggested by Richard. The array-to-pointer decay
is now well-formed; the check was instead moved to the pointer
arithmetic facility.
https://reviews.l
rsmith added a comment.
This needs testcases (the one from your summary plus the ones in my comments
above would be good).
Comment at: lib/AST/ExprConstant.cpp:2622
// Next subobject is an array element.
- const ConstantArrayType *CAT = Info.Ctx.getAsConstantArrayT
Arcoth created this revision.
Arrays of unknown bound are subject to some bugs in constant expressions.
const extern int arr[];
constexpr int f(int i) {return arr[i];}
constexpr int arr[] {1, 2, 3};
int main() {constexpr int x = f(2);}
This is spuriously rejected. On the other hand,
extern cons
11 matches
Mail list logo