Skip to content

Instantly share code, notes, and snippets.

@afabri
Created January 19, 2022 13:44
Show Gist options
  • Save afabri/0416bebec1c32fb4efd6632446698972 to your computer and use it in GitHub Desktop.
Save afabri/0416bebec1c32fb4efd6632446698972 to your computer and use it in GitHub Desktop.
VC2017 /permissive- fails on this
#include <atomic>
#include <iostream>
struct Parallel_tag {};
template <typename K, typename C>
struct Base {
typedef int A;
};
template <typename K>
struct Base<K, Parallel_tag> {
typedef std::atomic<int> A;
};
template <typename K, typename C>
struct Derived : Base<K, C> {
typedef Base<K,C>::A A;
void fct();
A a = 0;
};
template <typename K,typename C>
void Derived<K,C>::fct()
{
++a;
std::cout << a << std::endl;
}
int main()
{
Derived<int,Parallel_tag> d;
d.fct();
return 0;
}
@afabri
Copy link
Author

afabri commented Jan 19, 2022

In fact VC2019 and VC2022 have the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment