Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #168

Defect Report: implicitly declared member function, noexcept or throw(), ambiguous.

Message-ID <cff819e2-6b6d-4b97-9018-38e6cfde613e@e7g2000vbw.googlegroups.com> (permalink)
Newsgroups comp.std.c++
From Yakov Galka <ybungalobill@gmail.com>
Subject Defect Report: implicitly declared member function, noexcept or throw(), ambiguous.
Organization http://groups.google.com
Date 2011-06-22 01:30 -0600

Show all headers | View raw


N3290, "15.4 Exception specifications [except.spec], (14)" says:

An implicitly declared special member function (Clause 12) shall have
an exception-specification. If f is
an implicitly declared default constructor, copy constructor, move
constructor, destructor, copy assignment
operator, or move assignment operator, its implicit exception-
specification specifies the type-id T if and only
if T is allowed by the exception-specification of a function directly
invoked by f’s implicit definition; f shall
allow all exceptions if any function it directly invokes allows all
exceptions, and f shall allow no exceptions
if every function it directly invokes allows no exceptions.

If it happens to allow no exceptions, should it be semantically
equivalent to a dynamic-exception-specification and call
std::unexpected, or to noexept(true) and call std::terminate directly?

It does matter in the following case:

struct X { ~X() { throw 0; } };

Here, according to "12.4 Destructors [class.dtor]", the above
paragraph applies. So ~X gets a non-throwing exception-specification.

struct X { ~X() noexcept { throw 0; } };
struct X { ~X() throw() { throw 0; } };

Which one?

--
Yakov Galka


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextNext in thread | Find similar


Thread

Defect Report: implicitly declared member function, noexcept or  throw(), ambiguous. Yakov Galka <ybungalobill@gmail.com> - 2011-06-22 01:30 -0600
  Re: Defect Report: implicitly declared member function, noexcept or  throw(), ambiguous. Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-06-22 08:22 -0600
  Re: Defect Report: implicitly declared member function, noexcept or   throw(), ambiguous. Andrzej Krzemieński <akrzemi1@gmail.com> - 2011-06-22 08:23 -0600
    Re: Defect Report: implicitly declared member function, noexcept or  throw(), ambiguous. Yakov Galka <ybungalobill@gmail.com> - 2011-06-23 13:46 -0600

csiph-web