The order of override and noexcept in the standard

c++, c++11, language-lawyer

Solution

Actually, yes, it is, its just hard to find out, since its a bit scattered. Annex A (Grammar summary) is of some help here. Lets try to find the specific bits:

declarator:
    ptr-declarator
    noptr-declarator parameters-and-qualifiers trailing-return-type

parameters-and-qualifiers:
    ( parameter-declaration-clause ) attribute-specifier-seqopt cv-qualifier-seqopt
    ref-qualifieropt exception-specificationot

exception-specification:
    dynamic-exception-specification
    noexcept-specification

noexcept-specification:
    noexcept ( constant-expression )
    noexcept

and then later for override

member-declarator:
    declarator virt-specifier-seqopt pure-specifieropt
    declarator brace-or-equal-initializeropt
    identifieropt attribute-specifier-seqopt: constant-expression

virt-specifier-seq:
    virt-specifier
    virt-specifier-seq virt-specifier

virt-specifier:
    override
    final

So a declarator is the thing that contains the noexcept keyword, but in the member-declarator the virt-specifier comes after the declarator.

Problem

Is the order of override and noexcept required by the standard? ``` class Base { public: virtual void foo() {} }; class Derived : public Base { public: // virtual void foo() override {} // Ok // virtual void foo() noexcept {} // Ok // virtual void foo() noexcept override {} // Ok virtual void foo() override noexcept {} // Error }; int main() {} ``` I'm using gcc 4.7.2.

Original source