C++ Logo

std-discussion

Advanced search

Re: Question about name lookup and class member?

From: Eric Suen <eric_suen_at_[hidden]>
Date: Mon, 7 Jun 2021 16:30:56 +0800
  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
}


> This is an item in issue
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325
> <http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325> . A
> couple of community members created an openoffice document during C++11
> last-minute-fixes and this was on that list.
>

Received on 2021-06-07 03:31:12