1 // { dg-options "-fdiagnostics-show-caret" } 2 // { dg-do compile { target c++11 } } 3 4 struct S 5 { 6 virtual friend void foo(); // { dg-error "3:virtual functions cannot be friends" } 7 /* { dg-begin-multiline-output "" } 8 virtual friend void foo(); 9 ^~~~~~~ ~~~~~~ 10 { dg-end-multiline-output "" } */ 11 friend virtual void bar(); // { dg-error "10:virtual functions cannot be friends" } 12 /* { dg-begin-multiline-output "" } 13 friend virtual void bar(); 14 ~~~~~~ ^~~~~~~ 15 { dg-end-multiline-output "" } */ 16 }; 17