1 // PR c++/58664 2 // { dg-do compile { target c++11 } } 3 4 struct F; // { dg-message "forward declaration" } 5 6 union U // { dg-message "not complete" } 7 { 8 U u; // { dg-error "field 'u' has incomplete type 'U'" } 9 }; 10 11 union CU // { dg-message "not complete" } 12 { 13 const CU u; // { dg-error "incomplete type" } 14 }; 15 16 template<typename T> 17 union UT // { dg-message "not complete" } 18 { 19 UT u; // { dg-error "incomplete type" } 20 }; 21 22 template union UT<int>; 23 24 union UF 25 { 26 F u; // { dg-error "field 'u' has incomplete type 'F'" } 27 }; 28 29 template<typename T> 30 union UFT 31 { 32 F u; // { dg-error "incomplete type" } 33 }; 34 35 template union UFT<int>; 36 37 struct S // { dg-message "not complete" } 38 { 39 S s; // { dg-error "field 's' has incomplete type 'S'" } 40 }; 41 42 struct VS // { dg-message "not complete" } 43 { 44 volatile VS s; // { dg-error "incomplete type" } 45 }; 46 47 template<typename T> 48 struct ST // { dg-message "not complete" } 49 { 50 ST s; // { dg-error "incomplete type" } 51 }; 52 53 template class ST<int>; 54 55 struct SF 56 { 57 F s; // { dg-error "field 's' has incomplete type 'F'" } 58 }; 59 60 template<typename T> 61 struct SFT 62 { 63 F s; // { dg-error "incomplete type" } 64 }; 65 66 template class SFT<int>; 67