]> granicus.if.org Git - clang/commit
Improve handling of arrays of unknown bound in constant expressions.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 1 May 2017 18:49:04 +0000 (18:49 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 1 May 2017 18:49:04 +0000 (18:49 +0000)
commit58733dee03764e37013293757571af3eb5baa54f
treee55e12314fda2ec1d4cdc1334e512980b32ea51d
parente3c69705dc8c78676e967df49c9603350529f2a0
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
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/ExprConstant.cpp
test/SemaCXX/constexpr-array-unknown-bound.cpp [new file with mode: 0644]