This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81429] New: maybe_unused attribute triggers syntax error when used on first argument to a constructor
- From: "jeff.benshetler at stackpath dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Jul 2017 14:44:45 +0000
- Subject: [Bug c++/81429] New: maybe_unused attribute triggers syntax error when used on first argument to a constructor
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429
Bug ID: 81429
Summary: maybe_unused attribute triggers syntax error when used
on first argument to a constructor
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jeff.benshetler at stackpath dot com
Target Milestone: ---
Created attachment 41746
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41746&action=edit
Preprocessed file that triggers the bug.
maybe_unused attribute triggers syntax error when used on first argument to a
constructor
Systm Type: Linux bnx1-lab1-dfw0.stackpath.systems 3.10.0-514.10.2.el7.x86_64
#1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Options given when GCC was configured/built:
tar xzf gcc-7.1.0.tar.gz
cd gcc-7.1.0
./contrib/download_prerequisites
cd ..
mkdir objdir-7.1.0
cd objdir-7.1.0
../gcc-7.1.0/configure --prefix=/opt/gcc-7.1.0 --enable-languages=c,c++
--disable-multilib
make -j60
sudo make install
Complete command line that triggers the bug: g++ -Wall -Wextra -save-temps -c
maybe_unused.cpp
Compiler Output
maybe_unused.cpp:3:9: error: expected unqualified-id before ‘[’ token
Foo([[maybe_unused]] int x) // fails
^
maybe_unused.cpp:3:9: error: expected ‘)’ before ‘[’ token
This bug occurs with gcc-6.3.0, gcc-6.4.0, gcc-7.1.0. clang-3.9 is fine with
the code.