22 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3struct __attribute__((packed)) {4 unsigned options;5 template <typename T>6 void getOptions() {7 (T *)&options;8 }9 template <typename U>10 void getOptions2() {11 (U)&options;12 }13} s;14 15struct __attribute__((packed)) { // expected-error {{anonymous structs and classes must be class members}}16 unsigned options ;17 template <typename T> getOptions() // expected-error {{a type specifier is required for all declarations}}18 {19 (T *) & options;20 }21};22