Skip to content
Discussion options

You must be logged in to vote

I think this behaves according to the specification (emphasis mine):

The remaining conditional_sections, if any, are processed as skipped_sections: except for pre-processing directives, the source code in the section need not adhere to the lexical grammar; no tokens are generated from the source code in the section; and pre-processing directives in the section must be lexically correct but are not otherwise processed.

Since #define SOMETHING 1 is not a lexically correct pre-processing directive in C#, the code is correctly reported as invalid C# by the compiler.

Since I don't think being able to write source that is valid for both C++ and C# is a goal of C#, you would probably need to f…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1867 on October 18, 2020 13:14.