As mentioned in this post:
http://gcc.gnu.org/ml/libstdc++/2009-05/msg00000.html
gcc accepts the ill-formed code below. According to [except.spec], p2:

  If any declaration of a function has an exception-specification,
  all declarations, including the definition and an explicit
  specialization, of that function shall have an exception-
  specification with the same set of type-ids.

$ cat t.cpp && g++ -c -Wall -Wextra -pedantic t.cpp && echo FAIL
extern "C" void abort(void);
namespace std {
    extern "C" void abort(void) throw();
}

namespace std {
    extern "C" void abort(void) throw();
}
extern "C" void abort(void);
FAIL

See also bug 32081 and bug 24817 for similar problems in template code.


-- 
           Summary: missing diagnostic on conflicting exception
                    specifications
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39993

Reply via email to