Improve handling of arrays of unknown bound in constant expressions.
Do not spuriously reject constexpr functions that access elements of an array of unknown bound; this may later become valid once the bound is known. Permit array-to-pointer decay on such arrays, but disallow pointer arithmetic (since we do not know whether it will have defined behavior). The standard is not clear on how this should work, but this seems to be a decent answer. Patch by Robert Haberlach! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301822 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/DiagnosticASTKinds.td 3 additions, 1 deletioninclude/clang/Basic/DiagnosticASTKinds.td
- lib/AST/ExprConstant.cpp 136 additions, 106 deletionslib/AST/ExprConstant.cpp
- test/SemaCXX/constexpr-array-unknown-bound.cpp 25 additions, 0 deletionstest/SemaCXX/constexpr-array-unknown-bound.cpp
This diff is collapsed.
Please register or sign in to comment