[css] sass css: target parent class from child

I am using sass and found a problem. This is an example of what I am trying to do:

.message-error {
    background-color: red;

    p& {
        background-color: yellow
     }
  }

Expected css:

.message-error {
    background-color: red;
}
p.message-error {
    background-color: yellow ;
}

The idea: all elements with .message-error will be red, except if it is p.message-error. This is not real-life situation, just to show an example.

SASS is not able to compile this, I even tried string concatenation. Is there some plugin that will do exactly the same?

NOTE: I know I can put another css definition like

p.message-error{....}

under, but I would like to avoid that and use one place for all .message-error definitions.

Thanks.

This question is related to css sass

The answer is