Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
28 Views

cv-qualifier bug

The following code compiles fine with clang and g++ (-std=c++14) but fails with icc 2016:

 

#include <iostream>

template<class Derived>
struct ConstBase {
  template<bool T = true>
  int f() const {
    return 3;
  }
};

template<class Derived>
struct Base : ConstBase<Derived> {
  using ConstBase<Derived>::f;
  template<bool T = true>
  int f() {
    const Derived& derived = static_cast<const Derived&>(*this);
    return derived.f();
  }
};

struct A : Base<A> {
};

int main() {
  A a;
  std::cout << a.f() << "\n";
  return 0;
}

 

0 Kudos
2 Replies
Highlighted
Employee
28 Views

Thanks for your report. I submitted this to the development team and I will let you know when I have more information (reference ID DPD200371618).

0 Kudos
Highlighted
Employee
28 Views

This issue is fixed in compiler version 16.0.1 (XE 2016 Update 1):

$ icpc -V -std=c++14 test.cpp

Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.1.150 Build 20151021
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

Edison Design Group C/C++ Front End, version 4.10 (Oct 22 2015 02:30:09)
Copyright 1988-2014 Edison Design Group, Inc.

GNU ld version 2.23.52.0.1-16.el7 20130226

0 Kudos