mardi 24 novembre 2015

My mistake, or bug in intel compiler? sizeof a non-static member error

It is my belief that this code:

#include <stdio.h>

struct foo {
    char array[1024];
};

int main() { 
    fprintf(stderr, "sizeof(foo::array): %zd\n", sizeof(foo::array));    
}

Is valid C++. g++ compiles it just fine with -ansi -pedantic. However, compiling with Intel's icc 12.1.3 I get:

error #288: a nonstatic member reference must be relative to a specific object

Is it my mistake or is icc doing the wrong thing re: the C++ spec?

Aucun commentaire:

Enregistrer un commentaire