Skip to content

Instantly share code, notes, and snippets.

@resetius
Created April 20, 2017 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resetius/063750a05b0a2f8f6bd4a0f99a7158ca to your computer and use it in GitHub Desktop.
Save resetius/063750a05b0a2f8f6bd4a0f99a7158ca to your computer and use it in GitHub Desktop.
#include <vector>
#include <tbb/enumerable_thread_specific.h>
class A;
class B {
public:
//std::vector<std::vector<A> > b; // <- can be compiled both g++ and cl
tbb::enumerable_thread_specific<std::vector<A> > b; // <- fails on cl
~B();
B();
};
class C {
public:
B b;
};
int main() {
C c;
};
// g++ -c 1.cpp => ok
/*
C:\temp>cl /EHsc -c 1.cpp -Ic:/Inst/mkl
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
1.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(1642): error C2036: 'A *': unknown size
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(1636): note: while compiling class template member function 'void std::vector<A,std::allocator<_Ty>>::_Tidy(void)'
with
[
_Ty=A
]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(976): note: see reference to function template instantiation 'void std::vector<A,std::allocator<_Ty>>::_Tidy(void)' being compiled
with
[
_Ty=A
]
c:/Inst/mkl\tbb/enumerable_thread_specific.h(797): note: see reference to class template instantiation 'std::vector<A,std::allocator<_Ty>>' being compiled
with
[
_Ty=A
]
c:/Inst/mkl\tbb/enumerable_thread_specific.h(796): note: while compiling class template member function 'void *tbb::interface6::enumerable_thread_specific<std::vector<A,std::allocator<_Ty>>,tbb::cache_aligned_allocator<T>,tbb::ets_no_key>::create_local(void)'
with
[
_Ty=A,
T=std::vector<A,std::allocator<A>>
]
1.cpp(9): note: see reference to class template instantiation 'tbb::interface6::enumerable_thread_specific<std::vector<A,std::allocator<_Ty>>,tbb::cache_aligned_allocator<T>,tbb::ets_no_key>' being compiled
with
[
_Ty=A,
T=std::vector<A,std::allocator<A>>
]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment