Date
2022-11-20.07:54:16
Message id
611

Content

Is the comma expression in the following dependent?

  template <class T> static void f(T)
  {
  }
  template <class T> void g(T)
  {
    f((T::x, 0));
  }
  struct A {
    static int x;
  };
  void h()
  {
    g(A());
  }

According to the standard, it is, because 13.8.3.3 [temp.dep.expr] says that an expression is dependent if any of its sub-expressions is dependent, but there is a question about whether the language should say something different. The type and value of the expression are not really dependent, and similar cases (like casting T::x to int) are not dependent.

Mark Mitchell: If the first operand is dependent, how do we know it does not have an overloaded comma operator?