Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Intel 2021.3.0 C++ Problem

Frank_R_1
Beginner
1,304 Views

Hi,

 

using Intel oneAPI 2021.3.0 the following code does not compile:

################################################

#include <array>

 

class Base {

  public:

    enum Types { Al, Mg };

    static constexpr unsigned int P = 2;

    static constexpr unsigned int bin_Al = 1;

    static constexpr unsigned int bin_Mg = 300;

 

    static constexpr std::array<unsigned int, P> bins{bin_Al, bin_Mg}; 

    Base();

};

 

template <typename Base::Types pNo>

class Derived : public Base {

  public:

    Derived();

  public:

    static std::array<double, bins[pNo]> particle_radii;

};

 

template <typename Base::Types pNo>

std::array<double, Base::bins[pNo]> Derived<pNo>::particle_radii;

################################################

With Intel oneAPI 2021.2.0 it works on LINUX RHEL7 devtoolset-9 and WINDOWS 10 VS 2019 16.10.

 

Anyone knows what is wrong?

Best regards

Frank

 

0 Kudos
6 Replies
Frank_R_1
Beginner
1,281 Views

#output 2021.2.0

icl -c -Qstd=c++17 a.cxx
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.

a.cxx

 

#output 2021.3.0

icl -c -Qstd=c++17 a.cxx
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.

a.cxx


a.cxx(23): error: declaration is incompatible with "std::array<double, <expression>> Derived<pNo>::particle_radii" (declared at line 19)
std::array<double, Base::bins[pNo]> Derived<pNo>::particle_radii;
^

compilation aborted for a.cxx (code 2)

0 Kudos
Frank_R_1
Beginner
1,281 Views

sorry previous post was wrong, here is the correct one:

#output 2021.3.0

icl -c -Qstd=c++17 a.cxx
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.

a.cxx
a.cxx(23): error: declaration is incompatible with "std::array<double, <expression>> Derived<pNo>::particle_radii" (declared at line 19)
std::array<double, Base::bins[pNo]> Derived<pNo>::particle_radii;
^

compilation aborted for a.cxx (code 2)


#output compxe 2020.1 (oneAPI 2021.2.0 also does this)

icl -c -Qstd=c++17 a.cxx
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.

a.cxx

0 Kudos
SantoshY_Intel
Moderator
1,278 Views

Hi,

 

Thanks for reaching out to us.

We are able to reproduce the error on a Linux machine having intel oneAPI 2021.3 installed. However we will get back to u soon regarding the error on windows machine.

 

Thanks,

Santosh

 

0 Kudos
Frank_R_1
Beginner
1,275 Views

With

static double particle_radii[bins[pNo]];
and

template <typename Base::Types pNo>
double Derived<pNo>::particle_radii[Base::bins[pNo]];

it works!

 

The compile output you can see above.

0 Kudos
SantoshY_Intel
Moderator
1,183 Views

Hi,


We are working on your issue internally and we will get back to you soon.


Thanks & Regards,

Santosh


0 Kudos
Viet_H_Intel
Moderator
786 Views

Hi,

 

Not sure if you are aware of, but Intel Classic Compiler will enter "Legacy Product Support" mode, signaling the end of regular updates. For that reason, we won't fix this issue in icl. Please migrate your code to icx.

I am going to close this thread as "wont fix".

https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.h...

 

Sorry for the inconvenience.

 

0 Kudos
Reply