[PATCH] D60934: [clang] adding explicit(bool) from c++2a
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 6 13:18:15 PDT 2019
rsmith reopened this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:373-374
+ ExplicitSpecifier ES, FunctionDecl *New) {
+ if (!ES.getExpr() || ES.getKind() != ExplicitSpecKind::Unresolved)
+ return ES;
+ Expr *OldCond = ES.getExpr();
----------------
This is incorrect: you still need to substitute into an //explicit-specifier// even if you've already resolved it, at least if it's instantiation-dependent. (Substitution could fail, and if it does, you need to produce the error.) For example:
```
template<typename T> struct A {
explicit(sizeof(sizeof(T::error)) == sizeof(sizeof(int))) A();
};
```
Here, the expression in the //explicit-specifier// is neither type-dependent nor value-dependent, but it is instantiation-dependent, and substitution into it should fail when, say, `T` is `int`. (Instantiating `A<int>` should fail with an error.)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60934/new/
https://reviews.llvm.org/D60934
More information about the cfe-commits
mailing list