Files
clang-p2996/clang/test/Modules/Inputs/PR28752/vector
Richard Smith edbc6e93e1 Reinstate r284008 reverted in r284081, with two fixes:
1) Merge and demote variable definitions when we find a redefinition in
MergeVarDecls, not only when we find one in AddInitializerToDecl (we only reach
the second case if it's the addition of the initializer itself that converts an
existing declaration into a definition). 

2) When rebuilding a redeclaration chain for a variable, if we merge two
definitions together, mark the definitions as merged so the retained definition
is made visible whenever the demoted definition would have been.

Original commit message (from r283882):

[modules] PR28752: Do not instantiate variable declarations which are not visible.

Original patch by Vassil Vassilev! Changes listed above are mine.

llvm-svn: 284284
2016-10-14 21:41:24 +00:00

28 lines
704 B
Plaintext

#ifndef VECTOR
#define VECTOR
template <bool, typename> struct B;
template <typename _Tp> struct B<true, _Tp> { typedef _Tp type; };
namespace std {
template <typename> struct D {
template <typename _Alloc2> struct F {
static const bool value = 0;
};
template <typename _Alloc2>
typename B<F<_Alloc2>::value, _Alloc2>::type _S_select(_Alloc2);
template <typename _Alloc2>
static
typename B<!F<_Alloc2>::value, _Alloc2>::type _S_select(_Alloc2);
};
template <typename _Alloc>
template <typename _Alloc2>
const bool D<_Alloc>::F<_Alloc2>::value;
template <typename> class vector {
public:
vector(int);
vector(vector &) : vector(D<bool>::_S_select((bool)0)) {}
};
}
#endif // VECTOR