https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71773
Bug ID: 71773
Summary: [7 Regression] bogus? error: invalid use of incomplete
type
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: trippels at gcc dot gnu.org
Target Milestone: ---
markus@x4 /tmp % cat scopes.ii
namespace std {
template <int> struct conditional;
template <typename...> struct A;
template <typename _B1, typename _B2>
struct A<_B1, _B2> : conditional<_B1::value> {};
template <typename> struct B;
template <typename _Tp> struct F : B<_Tp> {};
template <int> struct C;
template <typename _Tp> typename C<A<F<_Tp>, _Tp>::value>::type swap(_Tp, _Tp);
template <typename> struct D {
int _M_fill_init;
void m_fn1(D p1) { std::swap(0, p1._M_fill_init); }
};
}
markus@x4 /tmp % icpc -Wall -Wextra -std=c++14 -c scopes.ii
markus@x4 /tmp % clang++ -Wall -Wextra -std=c++14 -c scopes.ii
markus@x4 /tmp % g++ -Wall -Wextra -c scopes.ii # gcc-6
markus@x4 /tmp % /var/tmp/gcc_test/usr/local/bin/g++ -c scopes.ii # trunk
scopes.ii: In instantiation of ‘struct std::F<int>’:
scopes.ii:5:8: required from ‘struct std::A<std::F<int>, int>’
scopes.ii:9:65: required by substitution of ‘template<class _Tp> typename
std::C<std::A<std::F<_Tp>, _Tp>::value>::type std::swap(_Tp, _Tp) [with _Tp =
int]’
scopes.ii:12:50: required from here
scopes.ii:7:32: error: invalid use of incomplete type ‘struct std::B<int>’
template <typename _Tp> struct F : B<_Tp> {};
^
scopes.ii:6:28: note: declaration of ‘struct std::B<int>’
template <typename> struct B;
^
scopes.ii: In instantiation of ‘struct std::A<std::F<int>, int>’:
scopes.ii:9:65: required by substitution of ‘template<class _Tp> typename
std::C<std::A<std::F<_Tp>, _Tp>::value>::type std::swap(_Tp, _Tp) [with _Tp =
int]’
scopes.ii:12:50: required from here
scopes.ii:5:8: error: ‘value’ is not a member of ‘std::F<int>’
struct A<_B1, _B2> : conditional<_B1::value> {};
^~~~~~~~~~~
scopes.ii: In member function ‘void std::D< <template-parameter-1-1>
>::m_fn1(std::D< <template-parameter-1-1> >)’:
scopes.ii:12:50: error: no matching function for call to ‘swap(int, int&)’
void m_fn1(D p1) { std::swap(0, p1._M_fill_init); }
^
scopes.ii:9:65: note: candidate: template<class _Tp> typename
std::C<std::A<std::F<_Tp>, _Tp>::value>::type std::swap(_Tp, _Tp)
template <typename _Tp> typename C<A<F<_Tp>, _Tp>::value>::type swap(_Tp,
_Tp);
^~~~
scopes.ii:9:65: note: substitution of deduced template arguments resulted in
errors seen above