This is the mail archive of the gcc-bugs@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]

[Bug c++/78388] Bogus "declaration shadows template parameter" error with parenthesized function-style casts


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78388

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-08-23
                 CC|                            |egallager at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Confirmed that gcc errors and clang doesn't:

$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow 78388.cc
78388.cc: In function ‘void f()’:
78388.cc:4:17: error: declaration of ‘void i’ shadows template parameter
     (int((void(i), 1))) + 0;
                 ^
78388.cc:1:10: note: template parameter ‘i’ declared here
 template<int i>
          ^~~
$ /sw/opt/llvm-3.1/bin/clang++ -c -Wall -Wextra -pedantic -Wshadow 78388.cc
78388.cc:4:25: warning: expression result unused [-Wunused-value]
    (int((void(i), 1))) + 0;
    ~~~~~~~~~~~~~~~~~~~ ^ ~
1 warning generated.
$

Function-style casts are evil, see bug 69818 (which is asking for a warning in
a different context, but still)

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