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

icc 17.0.0 rejects valid C++ code with variable argument function

Zhendong_Su
Beginner
708 Views

Compiler version and platform: 

Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.0.098 Build 20160721

The latest clang also incorrectly rejects the code. 

$ g++-6.2 -Wall -Wextra -pedantic -std=c++14 small.cpp
$ 
$ icc -std=c++14 small.cpp
small.cpp(12): error: a non-POD (Plain Old Data) class type cannot be fetched by va_arg
    A v = va_arg (a, A);
          ^

small.cpp(19): warning #1595: non-POD (Plain Old Data) class type passed through ellipsis
    foo (t, t);
            ^

compilation aborted for small.cpp (code 2)
$ 
$ cat small.cpp
#include <cstdarg>

struct A
{
  virtual ~A () {}
};

void foo (A p, ...)
{
  va_list a; 
  va_start (a, p);
  A v = va_arg (a, A);
  va_end (a);
}

int main ()
{
  A t;
  foo (t, t);
  return 0;
}
$ 

 

0 Kudos
3 Replies
Varsha_M_Intel
Employee
708 Views

Hi,

Please allow me sometime to reproduce and debug this issue. I will update you as soon as I am able to reproduce.

Thanks,
Varsha

0 Kudos
MalReddy_Y_Intel
Employee
708 Views

Hi

 This issue has been escalated to engineering team, will check status and keep update you.

Thanks,

Reddy

 

0 Kudos
MalReddy_Y_Intel
Employee
708 Views

This issue is addressed in the 17.0 up4 compiler, hence closed it.

Thanks,

0 Kudos
Reply