简体   繁体   中英

MSVC chokes in forward class template declaration

MSVC fails to compile

#include <iostream>

template<int N, int = N>
struct A;

template<int, int V>
struct A{static constexpr int VALUE = V;};

int main() {
  A<1> a;
  std::cout << a.VALUE;
}

It was a bug in MSVC manifested up to compiler version 19.22, and fixed in 19.23. Demo: https://gcc.godbolt.org/z/occvKEfc3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM