Visual C++ Compiler Error C2289

Message Text

same type qualifier used more than once


Error C2289 is concerned with modifiers in declarations. There are several cases, two that apply in reality and one that is documented but illusory.

First, if the /Za option is enabled, error C2289 follows from repeating any of the following modifiers

The Microsoft language extensions (as enabled by /Ze, which is the default) relax this case of the error to warning C4114.

Second, and independently of /Za versus /Ze, error C2289 also follows if the __based modifier is repeated and changed, i.e., between being based on void and being based on a pointer. Simple repetition of __based (void) is not an error. Neither is repetition of __based (pointer), even if changing the pointer.

The product documentation lists signed and unsigned among the modifiers whose repetition causes error C2289. Perhaps they were once upon a time, but they are definitely not for version 13.00.9466 of the C++ compiler. It is easily demonstrable that repeating signed or unsigned causes warning C4114 under both /Za and /Ze.