diff options
author | Richard Smith <richard@metafoo.co.uk> | 2019-12-04 17:31:58 -0800 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2019-12-04 18:55:23 -0800 |
commit | a1d2611c046efa46cf32a10c9e9a8a7a8a06feba (patch) | |
tree | 00e6404b67ed982a1a65456b1a883bea4284c0c2 /clang/lib/Sema/SemaTemplate.cpp | |
parent | 039d4b3aa20a8f36ad058f2b9692b73c6909c612 (diff) | |
download | bcm5719-llvm-a1d2611c046efa46cf32a10c9e9a8a7a8a06feba.tar.gz bcm5719-llvm-a1d2611c046efa46cf32a10c9e9a8a7a8a06feba.zip |
[c++17] Fix assert / wrong code when passing a noexcept pointer to
member function to a non-noexcept pointer to member non-type template
parameter.
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index a85fb6c1dc8..e800f7fe742 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -7004,15 +7004,21 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, // We might need to perform a trailing qualification conversion, since // the element type on the parameter could be more qualified than the - // element type in the expression we constructed. + // element type in the expression we constructed, and likewise for a + // function conversion. bool ObjCLifetimeConversion; - if (IsQualificationConversion(((Expr*) RefExpr.get())->getType(), + QualType Ignored; + if (IsFunctionConversion(RefExpr.get()->getType(), ParamType, Ignored) || + IsQualificationConversion(RefExpr.get()->getType(), ParamType.getUnqualifiedType(), false, ObjCLifetimeConversion)) - RefExpr = ImpCastExprToType(RefExpr.get(), ParamType.getUnqualifiedType(), CK_NoOp); + RefExpr = ImpCastExprToType(RefExpr.get(), + ParamType.getUnqualifiedType(), CK_NoOp); + // FIXME: We need to perform derived-to-base or base-to-derived + // pointer-to-member conversions here too. assert(!RefExpr.isInvalid() && - Context.hasSameType(((Expr*) RefExpr.get())->getType(), + Context.hasSameType(RefExpr.get()->getType(), ParamType.getUnqualifiedType())); return RefExpr; } |