Edit

Share via


Compiler Error C3409

empty attribute block is not allowed

Remarks

The square brackets were interpreted by the compiler as an attribute block, but no attributes were found.

The compiler may generate this error when you use square brackets as part of the definition of a lambda expression. This error occurs when the compiler cannot determine whether the square brackets are part of the definition of a lambda expression or of an attribute block. For more information about lambda expressions, see Lambda Expressions.

To correct this error

  1. If the square brackets are part of an attribute block:

    1. Provide one or more attributes in the attribute block.

    2. Remove the attribute block.

  2. If the square brackets are part of a lambda expression, make sure that the lambda expression follows valid syntax rules.

    For more information about lambda expression syntax, see Lambda Expression Syntax.

Examples

The following example generates C3409.

// C3409.cpp
// compile with: /c
#include <windows.h>
[]   // C3409
class a {};

// OK
[object, uuid("00000000-0000-0000-0000-000000000000")]
__interface x {};

[coclass, uuid("00000000-0000-0000-0000-000000000001")]
class b : public x {};

The following example generates C3409 because a lambda expression uses the mutable specification, but does not provide a parameter list. The compiler cannot determine whether the square brackets are part of the definition of a lambda expression or of an attribute block.

// C3409b.cpp

int main()
{
   [] mutable {}();
}

See also

attribute
Lambda Expressions
Lambda Expression Syntax