| 1 |
// PR c++/87750 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename T> |
| 5 |
class Bar |
| 6 |
{ |
| 7 |
protected: |
| 8 |
template <bool B> |
| 9 |
int process(int) { return 0; } |
| 10 |
}; |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
class Derived : Bar<T> |
| 14 |
{ |
| 15 |
using Base = Bar<T>; |
| 16 |
// Note applying Base::template workaround in (2) and commenting |
| 17 |
// this out then compiles. |
| 18 |
using Base::process; |
| 19 |
public: |
| 20 |
void foo() |
| 21 |
{ |
| 22 |
// (1) workaround: this->template |
| 23 |
// This line only fails on gcc 8.x, works in clang/icc/msvc. |
| 24 |
process<false>(); |
| 25 |
} |
| 26 |
|
| 27 |
template <bool B> |
| 28 |
int process() |
| 29 |
{ |
| 30 |
// (2) workaround: this->template or Base::template |
| 31 |
// Note clang 5 & 6 don't accept this line either, but clang 7 does. |
| 32 |
return process<B>(1); |
| 33 |
} |
| 34 |
}; |
| 35 |
|
| 36 |
int main() |
| 37 |
{ |
| 38 |
Derived<int> x; |
| 39 |
return x.process<false>(); |
| 40 |
} |