- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icpc --version
icpc (ICC) 13.0.1 20121010
with attribute packed turn on gets this error:
test.cpp(27): error: invalid type conversion: "char *" to "const char (&)[7]"
set(ms.data);
without the attribute packed it compiles fine.
is this correct behavior?
#include <iostream>
#include <string.h>
char msg[90];
//struct __attribute__((__packed__)) MyStruct
struct MyStruct
{
char data[7];
};
void set( const char (&str)[7] )
{
memcpy(msg,str,7);
}
int main()
{
char str[7];
str[0] = '1';
str[1] = 0;
MyStruct ms;
set(ms.data);
set(str);
std::cout << msg << std::endl;
return 0;
}
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks like a bug. I have entered it into our internal bug tracking database as DPD200248124. Thanks for reporting it to us.
Judy

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page