зеркало из https://github.com/microsoft/clang.git
Ensure we enter an unevaluated context when instantiating a noexcept
expression. Fixes bug raised by hhinnant to cfe-dev git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132350 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
951733d6ce
Коммит
eea06c609b
|
@ -7516,6 +7516,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
|
|||
template<typename Derived>
|
||||
ExprResult
|
||||
TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
||||
EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
|
||||
ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
|
||||
if (SubExpr.isInvalid())
|
||||
return ExprError();
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -std=c++0x %s
|
||||
|
||||
template <class T>
|
||||
T&&
|
||||
declval() noexcept;
|
||||
|
||||
template <class T>
|
||||
struct some_trait
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void swap(T& x, T& y) noexcept(some_trait<T>::value)
|
||||
{
|
||||
T tmp(static_cast<T&&>(x));
|
||||
x = static_cast<T&&>(y);
|
||||
y = static_cast<T&&>(tmp);
|
||||
}
|
||||
|
||||
template <class T, unsigned N>
|
||||
struct array
|
||||
{
|
||||
T data[N];
|
||||
|
||||
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
};
|
||||
|
||||
struct DefaultOnly
|
||||
{
|
||||
DefaultOnly() = default;
|
||||
DefaultOnly(const DefaultOnly&) = delete;
|
||||
DefaultOnly& operator=(const DefaultOnly&) = delete;
|
||||
~DefaultOnly() = default;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
array<DefaultOnly, 1> a, b;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче