]> granicus.if.org Git - clang/commit
Reject attempts to call non-static member functions on objects outside
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 11 May 2019 02:00:06 +0000 (02:00 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 11 May 2019 02:00:06 +0000 (02:00 +0000)
commitede407975c9986dd4992e86f7adcf28cd2c83b74
tree80736afad2a9cc490089f8d1dfc189e95dcac66d
parent7eda614874ea7ab87196c6698b4af9a61e8595b1
Reject attempts to call non-static member functions on objects outside
their lifetime in constant expressions.

This is undefined behavior per [class.cdtor]p2.

We continue to allow this for objects whose values are not visible
within the constant evaluation, because there's no way we can tell
whether the access is defined or not, existing code relies on the
ability to make such calls, and every other compiler allows such
calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360499 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/ExprConstant.cpp
test/CXX/expr/expr.const/p2-0x.cpp
test/SemaCXX/constant-expression-cxx11.cpp