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
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
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 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
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 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 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
Arcoth created this revision.
Herald added a reviewer: EricWF.
See https://bugs.llvm.org/show_bug.cgi?id=32856. Basically, as this code was
written before placeholder return types for functions were a
thing, the function call operators of __bind apply decltype on the call
expression to infer the
Arcoth added a comment.
In https://reviews.llvm.org/D32824#745392, @EricWF wrote:
> This change regresses other code. By changing `__bind_return<...>::type` into
> `decltype(auto)` you prevent the member functions from SFINAE'ing. For
> example:
>
> #include
>
> struct Func {
> templ