小编Tom*_*m R的帖子

将'using'指令与部分重载相结合:gcc功能还是intel bug?

我希望使用一组用C++编写的库和英特尔编译器.我附上了演示问题的示例代码.库中有很多地方使用'using'指令和部分重载(例如,我想从基类中使用foo(void)方法,但在派生类中重新实现第二个版本fo foo) .gcc没有问题,但英特尔确实如此.

#include <iostream>
template <class F>
struct Interface
  {
     static const F f=10;
  };

template <class F>
struct Base : public Interface<F>
  {
     void foo (void) { std::cout << "void" << std::endl; }
     template <class FF>
     void foo (Interface<FF> &ii) { std::cout << "F : " << ii.f << std::endl; }
  };

template <class F,int i>
struct Derived : public Base<F>
  {
    // void foo (void) { Base<F>::foo(); }  // works fine
    using Base<F>::foo;                     // gives error
    template …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-construction gcc overloading icc

7
推荐指数
1
解决办法
724
查看次数

标签 统计

c++ ×1

compiler-construction ×1

gcc ×1

icc ×1

overloading ×1