llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.06k stars 11.59k forks source link

rejects-valid on dependent type in exception specification of overriding function #23324

Open hubert-reinterpretcast opened 9 years ago

hubert-reinterpretcast commented 9 years ago
Bugzilla Link 22950
Version trunk
OS All
CC @DougGregor

Extended Description

In handling C++03 subclause 15.4 [except.spec] paragraph 3, it seems to me that an exception-specification containing a dependent type-id should not be checked to see if it only allows exceptions that are allowed by another (non-empty) exception-specification while processing the template definition (versus an instantiation).

SOURCE (<stdin>):

struct A {
   virtual void foo() throw(int) = 0;
};

template <typename T>
struct B : A {
   virtual void foo() throw(T);
};

COMPILER INVOCATION:

clang -fsyntax-only -x c++ -

ACTUAL OUTPUT:

<stdin>:7:17: error: exception specification of overriding function is more lax than base version
   virtual void foo() throw(T);
                ^
<stdin>:2:17: note: overridden virtual function is here
   virtual void foo() throw(int) = 0;
                ^
1 error generated.

EXPECTED OUTPUT:

No errors.

COMPILER VERSION INFO:

clang version 3.7.0 (trunk 232637)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/local/gcc-4.8.2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Selected GCC installation: /usr/local/gcc-4.8.2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Candidate multilib: .;@m64
Selected multilib: .;@m64
cfd43508-abed-4b61-9716-b28c9ef59019 commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#37913