E2541 Attribute '%s' cannot be set (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

This error occurs if the specified attribute cannot be applied to this entity.

For example, E2541 is generated when the noreturn attribute is set for a function that returns something.

int func(bool b) [[noreturn]]
{
  if (b)
    throw "Should not call this function";
  return 0; //Error E2541 noreturn.cpp 5: Attribute 'noreturn' cannot be set in ... 
}


See Also