view gcc/testsuite/g++.dg/cpp1y/var-templ2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile { target c++14 } }

// Template variables and static member variables of template classes are
// often confused.

template<typename T>
  struct S1
  {
    static int n;
    static int arr[];
  };

template<typename T>
  constexpr int var = sizeof (T);

template<typename T>
  int S1<T>::n = sizeof (T);

template<typename T>
  int S1<T>::arr[sizeof (T)];

template<>
  int S1<int>::n = 8;

template<>
  int S1<int>::arr[8];

int main ()
{
  S1<int> v1;
  var<S1<int>>;
  return 0;
}