On Mon, Jun 7, 2021 at 4:31 AM Eric Suen via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
  Does this apply to default template arguments? this cause some weird
bugs of compilers

#include <iostream>

struct A {
   template<int V = 1 + /*F<1>()*/> //no syntax error in MSVC
   int test() {
     return V;

   template<int V>
   static constexpr int F() {
     return V;

int main() {
   std::cout << A().test<1>();
   std::cout << A().test<>(); //error in MSVC

(I assume you didn't mean to comment out the "F<1>()" expression, since "template<int V = 1 + >" is certainly a syntax error.)

No, a default template argument is not a complete-class context ([class.mem]/6). Clang++ and g++ are correct to complain that "F" is not declared.

-- Andrew Schepler