alliedmodders / sourcepawn

A small, statically typed scripting language.
Other
369 stars 63 forks source link

#if !defined can't see enum member #816

Closed dragokas closed 2 years ago

dragokas commented 2 years ago

It's a downgrade from SP in SourceMod 1.10.

Example:

#include <sourcemod>

enum
{
    MY_INDEX
}

#if !defined MY_INDEX
    enum
    {
        MY_INDEX
    }
#endif

public void OnPluginStart()
{
}

Compile OK in Sourcemod v1.10.0.6478 Compile failed in Sourcemod v1.11.0.6902:

error 021: symbol already defined: "MY_INDEX"
Fyren commented 2 years ago

This was an intentional change made about ten months ago. If it's not a #define, the preprocessor doesn't know about it.

dvander commented 2 years ago

I've added a quick entry into the 1.11 docs about this:

https://github.com/alliedmodders/sourcepawn/blob/master/docs/upgrading-1.11.md#preprocessor-changes