[cfe-dev] g++.old-deja/g++.eh/spec7.C allow simple throw specs on pointers

John McCall rjmccall at apple.com
Tue Jul 30 09:48:33 PDT 2013


On Jul 30, 2013, at 4:04 AM, SENTHIL KUMAR THANGAVELU <senthil.t at samsung.com> wrote:
> Hello all,
>    There is a test case in gcc test suite g++.old-deja/g++.eh/spec7.C that causes compilation error in clang. I used latest clang git trunk. g++ 4.7.2 accepts this test case without any compilation error.
> 
> spec7.C:13:15: error: exception specification in declaration does not match previous declaration
> void (A::* A::pmf)() = &A::g;
>              ^
> spec7.C:10:20: note: previous declaration is here
>  static void (A::*pmf)() throw ();
>                   ^
> I can find the test case has been modified earlier to suit clang in this link https://llvm.org/viewvc/llvm-project/clang-tests/trunk/gcc-4_2-testsuite/src/g%2B%2B.old-deja/g%2B%2B.eh/spec7.C?sortby=date&r1=109903&r2=127628&pathrev=127628
> 
> Couldn't find other references as to why the test case was changed. Anyone can share the history of this issue?
> The question I have is, is the test case's expectation to ignore throw specs on function pointers correct ?

No.

C++11 [except.spec]p4:
  If any declaration of a pointer to function, reference to function, or
  pointer to member function has an exception-specification, all
  occurrences of that declaration shall have a compatible
  exception-specification.

John.



More information about the cfe-dev mailing list