Submitter:Fred J. Tydeman
Submission Date:2015-06-23
Document: WG14 N1943
Related: WG14 N1911
Summary
Based upon my reading of the standard, it appears that the following are ambiguous, so are a possible defect.
An example of that.
#line 500
#define MAC() __LINE__
#line 1000
int j = MAC(); /* is this 500 or 1000? */
However, 7.2.1.1 requires that the assert macro write information about the call that has a false expression. That information includes the __LINE__ and __FILE__ preprocessing macros. So, there is a requirement that this specific macro using __LINE__ and __FILE__ have the line number and file name of the invocation, not the line number and file name of the replacment list (in <assert.h>).
Suggested Technical Corrigendum
Add to 6.10.8.1, paragraph 1, item __LINE__:
The line number associated with a __LINE__ in a macro replacment list is the line number of the macro invocation.
Add to 6.10.8.1, paragraph 1, item __FILE__:
The source file name associated with a __FILE__ in a macro replacment list is the source file name of the macro invocation.