Files
clang-p2996/clang/test/CXX/expr/expr.post/expr.static.cast/p7.cpp
Richard Smith 1be59c5106 [c++1z] P0012R1: Implement a few remaining pieces: downgrade diagnostic for
mismatched dynamic exception specifications in expressions from an error to a
warning, since this is no longer ill-formed in C++1z.

Allow reference binding of a reference-to-non-noexcept function to a noexcept
function lvalue. As defect resolutions, also allow a conditional between
noexcept and non-noexcept function lvalues to produce a non-noexcept function
lvalue (rather than decaying to a function pointer), and allow function
template argument deduction to deduce a reference to non-noexcept function when
binding to a noexcept function type.

llvm-svn: 284905
2016-10-22 01:32:19 +00:00

11 lines
252 B
C++

// RUN: %clang_cc1 -std=c++1z -verify %s -fcxx-exceptions
void (*p)() noexcept;
void (*q)();
void f() {
// FIXME: This seems like a bad rule.
p = static_cast<decltype(p)>(q); // expected-error {{not allowed}}
q = static_cast<decltype(q)>(p);
}