Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22360

[[maybe_unused]] attribute not working

$
0
0

I am trying to ignore the unused parameter warning using the new c++17 attribute [[maybe_unused]], as below.

int main([[maybe_unused]] int argc, char** argv){    //...}

But I still get warning: unused parameter ‘argc’ [-Wunused-parameter] with the following additional warning.

warning: ‘maybe_unused’ attribute directive ignored [-Wattributes]

I'm using g++ (GCC) 7.2.0 with cmake-3.11.3. My compiler flags are as follows.

-std=c++17 -Wall -pedantic -Wextra -Weffc++

I remember using this attribute successfully before, but I have no idea why this is not working now. Could someone show what I am doing wrong here?


Viewing all articles
Browse latest Browse all 22360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>