Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Lesser__Nicolas
Beginner
84 Views

virt-specifier after function declared like a variable is not recognized

using F = void();

struct X {
  virtual F f;
};
 
struct Y : X {
F f override;
};
 
The code is valid, but ICC cannot compile the overriden function declaration in Y.
0 Kudos
5 Replies
Viet_H_Intel
Moderator
84 Views

Hi Nicolas,

What Intel compiler version did you use? and can you also let us know your command line options?

Thanks,

Viet 

Lesser__Nicolas
Beginner
84 Views

Hi and thanks for responding! :)

Oh yeah, I forgot. So I'm using ICC 18.0.0 with no command flag options at all.

Viet_H_Intel
Moderator
84 Views

I got the same error with Gnu7.3 and ICC 18.0

Can you confirm the error only seen with Intel Compiler and worked on GNU?

Thanks,

Viet 

$ icpc t2.cpp -c -std=c++17

t2.cpp(10): error: expected a ";"
  F f override;
      ^

compilation aborted for t2.cpp (code 2)
$ g++ t2.cpp -c -std=c++17
t2.cpp:10:3: error: expected ‘;’ at end of member declaration
 F f override;
   ^
 

Lesser__Nicolas
Beginner
84 Views

This is also a gcc bug. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87174

Clang compiles the code just fine.

The code is well-formed, as a member-declarator is defined as ([class.mem]):

> member-declarator:

> - declarator virt-specifier-seq[opt] pure-specifier[opt]

Here, 'override' is a virt-specifier belonging to the virt-specifier-seq.

 

Viet_H_Intel
Moderator
84 Views

I've reported this to the developer. The internal  bug is CMPLRS-52580

Thanks,

Viet 

Reply