]> granicus.if.org Git - clang/commit
Revisit PR10177: don't instantiate a variable if it's only referenced in a
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 6 Jan 2017 22:52:53 +0000 (22:52 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 6 Jan 2017 22:52:53 +0000 (22:52 +0000)
commit26313ca6595d5365a58ec08eab7d51492a4c0033
treea2de9e995a236be58656cf29a9c605adbc3ab27f
parentd362589cd8fd6f05349502c2c310063f5adc935d
Revisit PR10177: don't instantiate a variable if it's only referenced in a
dependent context and can't be used in a constant expression.

Per C++ [temp.inst]p2, "the instantiation of a static data member does not
occur unless the static data member is used in a way that requires the
definition to exist".

This doesn't /quite/ match that, as we still instantiate static data members
that are usable in constant expressions even if the use doesn't require a
definition. A followup patch will fix that for both variables and functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291295 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/Sema.h
lib/Sema/SemaExpr.cpp
lib/Sema/SemaTemplate.cpp
test/SemaCXX/PR10177.cpp
test/SemaCXX/undefined-internal.cpp