diff --git a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.final/p4.cpp b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.final/p4.cpp new file mode 100644 index 000000000000..cac362409a88 --- /dev/null +++ b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.final/p4.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +struct B1 { + [[final]] virtual void f(); // expected-note {{overridden virtual function is here}} +}; + +struct D1 : B1 { + void f(); // expected-error {{declaration of 'f' overrides a 'final' function}} +}; + +struct [[final]] B2 { // expected-note {{'B2' declared here}} +}; + +struct D2 : B2 { // expected-error {{derivation from 'final' struct B2}} +};