bug in C++ compiler 14.0.0: no instance of constructor matches the argument list

bug in C++ compiler 14.0.0: no instance of constructor matches the argument list

Imagen de Andrea B.

When
 - a constructor is called with an initializer list, made up of {}-initializers for a user-defined type
icpc complains with

error: no instance of constructor matches the argument list

while gcc (4.8.1) happily compiles the code.

How to reproduce:

#include <string>
#include <vector>
 

class Element {
public:
  Element(std::string const & s) :
    data(s)
  { }

  Element(std::string && s) :
    data(s)
  { }

  std::string const & read() const {
    return data;
  }

private:
  std::string data;
};

int main(void) {
  std::vector<Element> elements { { "hello" }, { "world" } };
}

Here is the actual error:

$ icpc -std=c++11 test.cpp -o test
test.cc(24): error: no instance of constructor "std::vector<_Tp, _Alloc>::vector [with _Tp=Element, _Alloc=std::allocator<Element>]" matches the argument list
argument types are: ({...}, {...})
std::vector<Element> elements { { "hello" }, { "world" } };
^

compilation aborted for test.cc (code 2)

AdjuntoTamaño
Descargar test.cpp338 bytes
publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Jennifer J. (Intel)

Thanks for the testcase.

I can see the same error and have filed a bug report (DPD200248554) for it.

Jennifer

Imagen de Andrea B.

Hi,
for the record, this is still open with Composer XW 2013 sp1:

$ icpc -v
icpc version 14.0.1 (gcc version 4.8.0 compatibility)

Imagen de Jennifer J. (Intel)

btw, this issue has been fixed. it should be in the next 14.0 update - update 2.

Jennifer

Imagen de QIAOMIN Q. (Intel)

Hello Andrea,

This issue has been fixed in the latest compiler sp1 update2. I'm closing this issue now ,since the problem has been fixed. Please feel free to reopen it if this is still an issue for you. Thank you for your issue submission.



Thank you.

--

QIAOMINQ.

Intel Developer Support

Inicie sesión para dejar un comentario.