V1115. Function annotated with the 'pure' attribute has side effects.

The analyzer has detected a function annotated as pure, but it is not.

You can annotate functions in the following ways:

A function is pure if it meets the following requirements:

Here are the most common cases in which a function purity is violated:

Take a look at the following example of an impure function annotated as pure:

[[gnu::pure]] void foo() 
{
  int *x = new int;
  ....
}

The 'foo' function is annotated in the code using the 'gnu::pure' attribute but allocates dynamic memory and violates the "no side effects" requirement.

To fix this, either remove the 'pure' attribute or modify the function as follows:

[[gnu::pure]] void foo()
{
  int x;
  ....
}