mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
Fix crash when checking a dependently-typed reference that is
initialized from a non-value-dependent initializer. llvm-svn: 363622
This commit is contained in:
parent
689509edab
commit
94bc88ebf4
@ -2282,7 +2282,7 @@ bool VarDecl::isUsableInConstantExpressions(ASTContext &Context) const {
|
||||
// declaration is encountered...
|
||||
const VarDecl *DefVD = nullptr;
|
||||
const Expr *Init = getAnyInitializer(DefVD);
|
||||
if (!Init || Init->isValueDependent())
|
||||
if (!Init || Init->isValueDependent() || getType()->isDependentType())
|
||||
return false;
|
||||
// ... if it is a constexpr variable, or it is of reference type or of
|
||||
// const-qualified integral or enumeration type, ...
|
||||
|
@ -63,6 +63,14 @@ namespace test5 {
|
||||
};
|
||||
}
|
||||
|
||||
namespace test6 {
|
||||
template<typename T> T f() {
|
||||
const T &v(0);
|
||||
return v;
|
||||
}
|
||||
int use = f<int>();
|
||||
}
|
||||
|
||||
namespace PR8795 {
|
||||
template <class _CharT> int test(_CharT t)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user