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

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

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
Highlighted
Employee
48 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
Highlighted
48 Views

Hi

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

Thanks,

Reddy

 

0 Kudos
Highlighted
48 Views

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

Thanks,

0 Kudos