Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1.18 KB

compiler-warning-level-1-c4091.md

File metadata and controls

38 lines (29 loc) · 1.18 KB
description title ms.date f1_keywords helpviewer_keywords
Learn more about: Compiler Warning (level 1 and level 2) C4091
Compiler Warning (level 1 and level 2) C4091
11/04/2016
C4091
C4091

Compiler Warning (level 1 and level 2) C4091

'keyword': ignored on left of 'type' when no variable is declared

The compiler detected a situation where the user probably intended a variable to be declared, but the compiler wasn't able to declare the variable.

Examples

A __declspec attribute at the beginning of a user-defined type declaration applies to the variable of that type. C4091 indicates no variable is declared. The following sample generates C4091.

// C4091.cpp
// compile with: /W1 /c
__declspec(dllimport) class X {}; // C4091

// __declspec attribute applies to varX
__declspec(dllimport) class X2 {} varX;

// __declspec attribute after the class or struct keyword
// applies to user defined type
class __declspec(dllimport) X3 {};

If an identifier is a typedef, it can't also be a variable name. The following sample generates C4091.

// C4091_b.cpp
// compile with: /c /W1 /WX
#define LIST 4
typedef struct _LIST {} LIST;   // C4091