#include <vector>
class A {
 public:
  A() {}
};

template<typename T>
void foo(const T &p) {
  union {
    typename std::remove_const<
      typename std::remove_reference<
        decltype(p[0])
      >::type
    >::type
    must_be_POD;
    
  } bar;
} 

int main() {
  int b[10];
  A   c[10];
  int *d = b;
  A   *e = c;
  foo(std::vector<int>(1)); // OK
  foo(b);                   // OK
  foo(d);                   // OK
 // foo(std::vector<A>(1));   // ERROR
 // foo(c);                   // ERROR
 // foo(e);                   // ERROR
  return 0;
}
