8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept4.C
Marek Polacek c46f1a1791 PR c++/87603 - constexpr functions are no longer noexcept.
* constexpr.c (is_sub_constant_expr): Remove unused function.
	* cp-tree.h (is_sub_constant_expr): Remove declaration.
	* except.c (check_noexcept_r): Don't consider a call to a constexpr
	function noexcept.

	* g++.dg/cpp0x/constexpr-noexcept.C: Adjust the expected result.
	* g++.dg/cpp0x/constexpr-noexcept3.C: Likewise.
	* g++.dg/cpp0x/constexpr-noexcept4.C: Likewise.
	* g++.dg/cpp0x/constexpr-noexcept8.C: New test.
	* g++.dg/cpp0x/inh-ctor32.C: Remove dg-message.
	* g++.dg/cpp1y/constexpr-noexcept1.C: New test.

From-SVN: r270320
2019-04-12 15:29:03 +00:00

16 lines
356 B
C

// { dg-do compile { target c++11 } }
// We used to treat a call to a constexpr function as noexcept if
// the call was a constant expression. We no longer do since
// c++/87603.
#define SA(X) static_assert(X,#X)
constexpr const int* f(const int *p) { return p; }
int main()
{
constexpr int i = 42;
SA(!noexcept(*f(&i)));
SA(!noexcept(f(&i)));
}