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

rs2740 at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 16 21:38:00 GMT 2016


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

            Bug ID: 78388
           Summary: Bogus "declaration shadows template parameter" error
                    with parenthesized function-style casts
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Reduced from http://stackoverflow.com/q/40637781/2756719: 

template<int i>
void f()
{
    (int((void(i), 1))) + 0;
}


prog.cc: In function 'void f()':
prog.cc:4:17: error: declaration of 'void i' shadows template parameter
     (int((void(i), 1))) + 0;
                 ^
prog.cc:1:10: note: template parameter 'i' declared here
 template<int i>
          ^~~

Accepted by Clang and GCC 4.3.6 on Wandbox
(http://melpon.org/wandbox/permlink/BHMa6ZyICjlVpvZi); rejected since 4.4,
apparently.


More information about the Gcc-bugs mailing list