On 03/26/2012 07:22 AM, Paolo Carlini wrote:
My basic idea so far is very simple:

--- class.c (revision 185792)
+++ class.c (working copy)
@@ -1001,6 +1001,10 @@ add_method (tree type, tree method, tree using_dec
+ else if (cxx_dialect >= cxx0x
+ TREE_TYPE (method) = build_exception_variant (TREE_TYPE (method),
+ noexcept_true_spec);

That would implement N1366, but implementing N3204 is a bit more involved. You need to copy TYPE_RAISES_EXCEPTIONS from the result of implicitly_declare_fn; see defaulted_late_check for something similar.

Also, this is too early, since we can't know what the eh specification of the implicit declaration would be until the closing brace of the class.

struct True2 { virtual ~True2(); };
struct False { ~False() noexcept(false); };

template <typename Base, typename Member>
struct C : Base
Member mem;

SA(!noexcept(C<True2, False>()));

it doesn't compile at all because:

noexcept_PR50043.C:21:8: error: looser throw specifier for ‘virtual
C<True2, False>::~C() noexcept (false)’
noexcept_PR50043.C:5:24: error: overriding ‘virtual True2::~True2()
noexcept (true)’

is this expected? Maybe, but I'm not sure.

Yes.  Adding noexcept to ~True2 causes the same error without your patch.


Reply via email to