This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [wwwdocs] Add a case to porting_to + a question wrt validity of another one


On Mon, Feb 6, 2017 at 12:13 PM, Marek Polacek <polacek@redhat.com> wrote:
> This patch adds a description of something I noticed while doing the
> Fedora mass rebuild.  Do we want to say more about the invalidity of
> the incomplete type case?

Here's the relevant rule in the standard:

14.6/8: "If a hypothetical instantiation of a template immediately
following its definition would be ill-formed due to a construct that
does not depend on a template parameter, the program is ill-formed; no
diagnostic is required.  If the interpretation of such a construct in
the hypothetical instantiation is different from the interpretation of
the corresponding construct in any actual instantiation of the
template, the program is ill-formed; no diagnostic is required. [
Note: This can happen in situations including the following:
* a type used in a non-dependent name is incomplete at the point at
which a template is defined but is complete at the point at which an
instantiation is performed, ...."

> Furthermore I noticed that the testcase below doesn't compile anymore since
> r240874; Nathan, is that desirable?
>
> class C {
> public:
>   virtual ~C() noexcept(false);
> };
> class A : virtual C {
>   virtual C m_fn1() = 0;
> };
> class B : A {};
>
> s.cc:8:7: error: looser throw specifier for ‘virtual B::~B() noexcept (false)’
>  class B : A {};
>        ^
> s.cc:5:7: error:   overriding ‘virtual A::~A() noexcept’
>  class A : virtual C {
>        ^

No, this is a bug.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]