diff options
author | Richard Trieu <rtrieu@google.com> | 2011-07-01 20:02:53 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2011-07-01 20:02:53 +0000 |
commit | 95d880933b940078a5e80cd50a3d206ac528faa7 (patch) | |
tree | 1ebabbbc5ddbded50f8fcc07205fe828e779f156 /clang/test/SemaCXX/PR7410.cpp | |
parent | cd1c0555286ff5aec940802f27a46fd1bae8aee7 (diff) | |
download | bcm5719-llvm-95d880933b940078a5e80cd50a3d206ac528faa7.tar.gz bcm5719-llvm-95d880933b940078a5e80cd50a3d206ac528faa7.zip |
Fix for PR7410. Allow functions in a derived class that improperly overwrite a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used.
llvm-svn: 134251
Diffstat (limited to 'clang/test/SemaCXX/PR7410.cpp')
-rw-r--r-- | clang/test/SemaCXX/PR7410.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/PR7410.cpp b/clang/test/SemaCXX/PR7410.cpp new file mode 100644 index 00000000000..6d2cda90b1d --- /dev/null +++ b/clang/test/SemaCXX/PR7410.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct BaseReturn {}; + +struct Base { + virtual BaseReturn Foo() = 0; // expected-note{{overridden virtual function is here}} +}; +struct X {}; +struct Derived : Base { + X Foo(); // expected-error{{virtual function 'Foo' has a different return type ('X') than the function it overrides (which has return type 'BaseReturn')}} +}; + +Derived d; |