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++/30863] New: Unsigned templatized struct treated as unsigned int


test.cc:

#include <stdio.h>

template<typename T>
struct s {
        s() {
                printf("Print me, please!\n");
        }
};

int main(){
        s<int> x;
        unsigned s<int> y;
}


% g++ -Wall test.cc -o test &&./test
test.cc: In function 'int main()':
test.cc:12: warning: unused variable 'y'
Print me, please!


First of all, I find it surprising that this even compiles. Secondly, the
"unsigned s<int>" is treated as "unsigned int" (note that "Print me, please!"
is only printed once).


-- 
           Summary: Unsigned templatized struct treated as unsigned int
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stonebone at planetunreal dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30863


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