This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to clear unused variable warnings created by static assert?


On 23 Jul 2015, at 23:40, Jeffrey Walton <noloader@gmail.com> wrote:

>> Why don't you simply use a C++ static_assert?
>> 
>> static_assert(foo==bar, "foo should have been bar");
> 
> C++ 03.
> 
> Jeff

You could try the typedef variant of the C++98 static assert and attach an attribute unused to the typedef.
See also:

http://stackoverflow.com/questions/6954284/why-prefer-template-based-static-assert-over-typedef-based-static-assert
http://stackoverflow.com/questions/386220/how-can-i-hide-defined-but-not-used-warnings-in-gcc

Cheers,
Oleg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]