|
22 | 22 | #include "clang/AST/Decl.h"
|
23 | 23 | #include "clang/AST/DeclObjC.h"
|
24 | 24 | #include "clang/AST/DeclTemplate.h"
|
| 25 | +#include "clang/AST/DependenceFlags.h" |
25 | 26 | #include "clang/AST/DynamicRecursiveASTVisitor.h"
|
26 | 27 | #include "clang/AST/EvaluatedExprVisitor.h"
|
27 | 28 | #include "clang/AST/Expr.h"
|
@@ -8332,7 +8333,7 @@ static bool checkDynamicCountPointerAsParameter(Sema &S, FunctionDecl *FDecl,
|
8332 | 8333 | if (!ArgInfo.isCountInParamOrCountPointer() && !ArgInfo.isCountInRet() &&
|
8333 | 8334 | !ParmInfo.isCountInParamOrCountPointer() && !ParmInfo.isCountInRet())
|
8334 | 8335 | continue;
|
8335 |
| - assert(!ActualArgExp->isValueDependent()); |
| 8336 | + |
8336 | 8337 | // Disable these checks for attribute-only mode because we don't want
|
8337 | 8338 | // non-type-incompatibility errors in that mode.
|
8338 | 8339 | if (!S.getLangOpts().isBoundsSafetyAttributeOnlyMode() &&
|
@@ -8903,7 +8904,10 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
|
8903 | 8904 | if (getLangOpts().BoundsSafetyAttributes && FDecl) {
|
8904 | 8905 | // FIXME: We need to support function pointers and blocks that don't have
|
8905 | 8906 | // function decl.
|
8906 |
| - if (!checkDynamicCountPointerAsParameter(*this, FDecl, TheCall)) |
| 8907 | + |
| 8908 | + // For C++, we don't want to check for any dependent constructs. |
| 8909 | + if (TheCall->getDependence() == ExprDependence::None && |
| 8910 | + !checkDynamicCountPointerAsParameter(*this, FDecl, TheCall)) |
8907 | 8911 | return ExprError();
|
8908 | 8912 | if (getLangOpts().BoundsSafety)
|
8909 | 8913 | if (!checkDynamicRangePointerAsParameter(*this, FDecl, TheCall))
|
|
0 commit comments