diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-07 06:59:51 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-07 06:59:51 +0000 |
commit | ff817f7070c0308e9d4486432b774005d4f8e420 (patch) | |
tree | e6285ec9559b2ec29884d288587eebeab57d5f4a /test/SemaTemplate/instantiate-exception-spec-cxx11.cpp | |
parent | 0f3d0970dcdf6cf17550b86838dff12813968dbc (diff) |
When marking virtual functions as used for a class' vtable, mark all functions
which will appear in the vtable as used, not just those ones which were
declared within the class itself. Fixes an issue reported as comment#3 in
PR12763 -- we sometimes assert in codegen if we try to emit a reference to a
function declaration which we've not marked as referenced. This also matches
gcc's observed behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-exception-spec-cxx11.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-exception-spec-cxx11.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp index 8a6f9efa68..c560c6ba2a 100644 --- a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp +++ b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp @@ -131,3 +131,17 @@ template<typename T> struct Derived : Base { Derived<Exc1> d1; // ok Derived<Exc2> d2; // expected-note {{in instantiation of}} + +// If the vtable for a derived class is used, the exception specification of +// any member function which ends up in that vtable is needed, even if it was +// declared in a base class. +namespace PR12763 { + template<bool *B> struct T { + virtual void f() noexcept (*B); // expected-error {{constant expression}} expected-note {{read of non-const}} + }; + bool b; // expected-note {{here}} + struct X : public T<&b> { + virtual void g(); + }; + void X::g() {} // expected-note {{in instantiation of}} +} |