LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 31999 - _Pragma in submacro
Summary: _Pragma in submacro
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: 4.0
Hardware: All Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-17 23:55 PST by samuel
Modified: 2019-04-15 16:30 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description samuel 2017-02-17 23:55:02 PST
_Pragmas should hide both warnings

clang-4.0 hides one warning, and clang++ hides neither

This is similar to bug 15129, but doesn't depend on concatenation, and is important to my code
-----------
#define HIDE(...) \
	_Pragma("clang diagnostic push") \
	_Pragma("clang diagnostic ignored \"-Wint-conversion\"") \
	__VA_ARGS__ \
	_Pragma("clang diagnostic pop")

#define A(B) B

int main(void) {
	int a;
	HIDE(a = (int*)0);

	A(HIDE(a = (int*)0)); }
Comment 1 Richard Smith 2019-04-15 16:30:31 PDT
> clang-4.0 hides one warning, and clang++ hides neither

The remaining warning in C mode is a bug. (I think we're getting confused when comparing the location of the conversion to the location of the pragma.)

The errors in C++ mode are intended; this code is invalid in C++. There is no implicit conversion from a pointer (not even a null pointer) to an integer in C++, and Clang does not allow such conversions as an extension.