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]

c++/4642: Very strange annoying warning about templates



>Number:         4642
>Category:       c++
>Synopsis:       Very strange annoying warning about templates
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 22 01:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     G++
>Release:        any release I tried (includeing 2.95.4 and 3.0.2 prereleases)
>Organization:
>Environment:
Intel Pentium II (i686)
Debian GNU/Linux
>Description:
The compiler emits very strange warnings about rather clean code. These warnings are really annoying, because the file the compiler warns about is included in many other files (in my project). I've done stripped down testcase. The compiler doesn'e like that I've changed order of template parameters in line 11 from the line 10's order. It warns about every attempt to use the _TN type in line 12 or later. This results in two screens of useless warnings (in my code).
The command I give:
g++ -c error.cpp
The output I get:
error.cpp:13: warning: lookup of `_TN' finds `class _TN'
error.cpp:13: warning:   instead of `typename B<_NY,_TN>::_TN' from dependent base class
error.cpp:13: warning:   (use `typename B::_TN' if that's what you meant)
>How-To-Repeat:
g++ -c error.cpp
>Fix:
1) Change the order of template parameters in line 11.
2) Don't typedef "_TN" type (even private!) in the base class.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; charset=iso-8859-1; name="error.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="error.cpp"

ZEdWdGNHeGhkR1VnUEdOc1lYTnpJRjlVVkU0c0lHTnNZWE56SUY5VVRrcytDbU5zWVhOeklFRUtl
d292CkwzQjFZbXhwWXpvS2NISnBkbUYwWlRvS0NYUjVjR1ZrWldZZ1gxUlVUaUJmVkU0N0NuMDdD
Z29LZEdWdApjR3hoZEdVZ1BHTnNZWE56SUY5T1dTd2dZMnhoYzNNZ1gxUk9QZ3BqYkdGemN5QkNJ
RG9nZG1seWRIVmgKYkNCd2RXSnNhV01nUVNBOFgxUk9MQ0JmVGxrK0Nuc0tDVjlVVGlCbWRXNWpJ
Q2dwSUQwZ01Ec0tmVHNLCg==


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