fork download
  1. template<typename T>
  2. constexpr int get(T vec) {
  3. return vec.get();
  4. }
  5.  
  6. struct coord {
  7. constexpr int get() const { return x; }
  8. int x;
  9. };
  10.  
  11. struct foo {
  12. struct coord2 {
  13. constexpr int get() const { return x; }
  14. int x;
  15. };
  16. constexpr static coord f = { 5 };
  17. constexpr static int g = get(f); // works
  18.  
  19. constexpr static coord2 h = { 5 };
  20. };
  21.  
  22. constexpr coord foo::f;
  23. constexpr foo::coord2 foo::h;
  24.  
  25. int main()
  26. {
  27. constexpr static int i = get(foo::h); // doesn't work
  28.  
  29. }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty