public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44559]  New: you can't use a typedef from a typename scope in a template
@ 2010-06-16 16:57 gcc at razorcam dot com
  2010-06-16 17:04 ` [Bug c++/44559] " pinskia at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc at razorcam dot com @ 2010-06-16 16:57 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3178 bytes --]

You can't use a typedef from a typename scope in a template
This is obviously a major bug and it means you can't access the typedefs of the
ISO standard library containers in order to use safe types to manipulate those
containers, when typename is such a container.

Here is the output of the command g++ bug_report_typedef.cc 
bug_report_typedef.cc: In function ‘void f(T)’:
bug_report_typedef.cc:3: error: expected ‘;’ before ‘i’
g++ -v follows the source code of bug_report_typedef.cc

template <typename T>
void f(T t){
        T::type i;
}

g++ -v bug_report_typedef.cc 
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.4-3'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.4 (Debian 4.4.4-3) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.4/cc1plus -quiet -v -D_GNU_SOURCE
bug_report_typedef.cc -quiet -dumpbase bug_report_typedef.cc -mtune=generic
-auxbase bug_report_typedef -version -o /tmp/ccgt4Dk8.s
GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
        compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR version
2.4.2-p1.
GGC heuristics: --param ggc-min-expand=57 --param ggc-min-heapsize=51739
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.4.4/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.4
 /usr/include/c++/4.4/x86_64-linux-gnu
 /usr/include/c++/4.4/backward
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.4.4/include
 /usr/lib/gcc/x86_64-linux-gnu/4.4.4/include-fixed
 /usr/include
End of search list.
GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
        compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR version
2.4.2-p1.
GGC heuristics: --param ggc-min-expand=57 --param ggc-min-heapsize=51739
Compiler executable checksum: a92c574e76687c18572fdbea97434cec
bug_report_typedef.cc: In function ‘void f(T)’:
bug_report_typedef.cc:3: error: expected ‘;’ before ‘i’


-- 
           Summary: you can't use a typedef from a typename scope in a
                    template
           Product: gcc
           Version: 4.4.4
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at razorcam dot com


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bug c++/44559]  New: you can't use a typedef from a typename scope in a template
  2010-06-16 16:57 [Bug c++/44559] New: you can't use a typedef from a typename scope in a template gcc at razorcam dot com
  2010-06-16 17:04 ` [Bug c++/44559] " pinskia at gmail dot com
@ 2010-06-16 17:04 ` Andrew Pinski
  2010-06-16 17:13 ` [Bug c++/44559] " redi at gcc dot gnu dot org
  2010-06-16 17:20 ` gcc at razorcam dot com
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Pinski @ 2010-06-16 17:04 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs



On Jun 16, 2010, at 9:57 AM, "gcc at razorcam dot com" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

> You can't use a typedef from a typename scope in a template
> This is obviously a major bug and it means you can't access the  
> typedefs of the
> ISO standard library containers in order to use safe types to  
> manipulate those
> containers, when typename is such a container.
>
> Here is the output of the command g++ bug_report_typedef.cc
> bug_report_typedef.cc: In function ‘void f(T)’:
> bug_report_typedef.cc:3: error: expected ‘;’ before ‘i’
> g++ -v follows the source code of bug_report_typedef.cc
>
> template <typename T>
> void f(T t){
>        T::type i;

You are missing the keyword typename. The standard requires this  
keyword on dependent names because it could be either a variable or a  
type. The standard assumes a variable name without the keyword.

> }
>
> g++ -v bug_report_typedef.cc
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian  
> 4.4.4-3'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable- 
> shared
> --enable-multiarch --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --enable- 
> threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 -- 
> enable-nls
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
> --with-arch-32=i486 --with-tune=generic --enable-checking=release
> --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64- 
> linux-gnu
> Thread model: posix
> gcc version 4.4.4 (Debian 4.4.4-3)
> COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic'
> /usr/lib/gcc/x86_64-linux-gnu/4.4.4/cc1plus -quiet -v -D_GNU_SOURCE
> bug_report_typedef.cc -quiet -dumpbase bug_report_typedef.cc - 
> mtune=generic
> -auxbase bug_report_typedef -version -o /tmp/ccgt4Dk8.s
> GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
>        compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR  
> version
> 2.4.2-p1.
> GGC heuristics: --param ggc-min-expand=57 --param ggc-min- 
> heapsize=51739
> ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
> ignoring nonexistent directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.4/../../../../x86_64-linux-gnu/ 
> include"
> ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
> #include "..." search starts here:
> #include <...> search starts here:
> /usr/include/c++/4.4
> /usr/include/c++/4.4/x86_64-linux-gnu
> /usr/include/c++/4.4/backward
> /usr/local/include
> /usr/lib/gcc/x86_64-linux-gnu/4.4.4/include
> /usr/lib/gcc/x86_64-linux-gnu/4.4.4/include-fixed
> /usr/include
> End of search list.
> GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
>        compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR  
> version
> 2.4.2-p1.
> GGC heuristics: --param ggc-min-expand=57 --param ggc-min- 
> heapsize=51739
> Compiler executable checksum: a92c574e76687c18572fdbea97434cec
> bug_report_typedef.cc: In function ‘void f(T)’:
> bug_report_typedef.cc:3: error: expected ‘;’ before ‘i’
>
>
> -- 
>           Summary: you can't use a typedef from a typename scope in a
>                    template
>           Product: gcc
>           Version: 4.4.4
>            Status: UNCONFIRMED
>          Severity: major
>          Priority: P3
>         Component: c++
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: gcc at razorcam dot com
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44559
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/44559] you can't use a typedef from a typename scope in a template
  2010-06-16 16:57 [Bug c++/44559] New: you can't use a typedef from a typename scope in a template gcc at razorcam dot com
@ 2010-06-16 17:04 ` pinskia at gmail dot com
  2010-06-16 17:04 ` [Bug c++/44559] New: " Andrew Pinski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gmail dot com @ 2010-06-16 17:04 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3865 bytes --]



------- Comment #1 from pinskia at gmail dot com  2010-06-16 17:04 -------
Subject: Re:   New: you can't use a typedef from a typename scope in a template



On Jun 16, 2010, at 9:57 AM, "gcc at razorcam dot com"
<gcc-bugzilla@gcc.gnu.org 
 > wrote:

> You can't use a typedef from a typename scope in a template
> This is obviously a major bug and it means you can't access the  
> typedefs of the
> ISO standard library containers in order to use safe types to  
> manipulate those
> containers, when typename is such a container.
>
> Here is the output of the command g++ bug_report_typedef.cc
> bug_report_typedef.cc: In function ‘void f(T)’:
> bug_report_typedef.cc:3: error: expected ‘;’ before ‘i’
> g++ -v follows the source code of bug_report_typedef.cc
>
> template <typename T>
> void f(T t){
>        T::type i;

You are missing the keyword typename. The standard requires this  
keyword on dependent names because it could be either a variable or a  
type. The standard assumes a variable name without the keyword.

> }
>
> g++ -v bug_report_typedef.cc
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian  
> 4.4.4-3'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable- 
> shared
> --enable-multiarch --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --enable- 
> threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 -- 
> enable-nls
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
> --with-arch-32=i486 --with-tune=generic --enable-checking=release
> --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64- 
> linux-gnu
> Thread model: posix
> gcc version 4.4.4 (Debian 4.4.4-3)
> COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic'
> /usr/lib/gcc/x86_64-linux-gnu/4.4.4/cc1plus -quiet -v -D_GNU_SOURCE
> bug_report_typedef.cc -quiet -dumpbase bug_report_typedef.cc - 
> mtune=generic
> -auxbase bug_report_typedef -version -o /tmp/ccgt4Dk8.s
> GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
>        compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR  
> version
> 2.4.2-p1.
> GGC heuristics: --param ggc-min-expand=57 --param ggc-min- 
> heapsize=51739
> ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
> ignoring nonexistent directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.4/../../../../x86_64-linux-gnu/ 
> include"
> ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
> #include "..." search starts here:
> #include <...> search starts here:
> /usr/include/c++/4.4
> /usr/include/c++/4.4/x86_64-linux-gnu
> /usr/include/c++/4.4/backward
> /usr/local/include
> /usr/lib/gcc/x86_64-linux-gnu/4.4.4/include
> /usr/lib/gcc/x86_64-linux-gnu/4.4.4/include-fixed
> /usr/include
> End of search list.
> GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
>        compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR  
> version
> 2.4.2-p1.
> GGC heuristics: --param ggc-min-expand=57 --param ggc-min- 
> heapsize=51739
> Compiler executable checksum: a92c574e76687c18572fdbea97434cec
> bug_report_typedef.cc: In function ‘void f(T)’:
> bug_report_typedef.cc:3: error: expected ‘;’ before ‘i’
>
>
> -- 
>           Summary: you can't use a typedef from a typename scope in a
>                    template
>           Product: gcc
>           Version: 4.4.4
>            Status: UNCONFIRMED
>          Severity: major
>          Priority: P3
>         Component: c++
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: gcc at razorcam dot com
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44559
>


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/44559] you can't use a typedef from a typename scope in a template
  2010-06-16 16:57 [Bug c++/44559] New: you can't use a typedef from a typename scope in a template gcc at razorcam dot com
  2010-06-16 17:04 ` [Bug c++/44559] " pinskia at gmail dot com
  2010-06-16 17:04 ` [Bug c++/44559] New: " Andrew Pinski
@ 2010-06-16 17:13 ` redi at gcc dot gnu dot org
  2010-06-16 17:20 ` gcc at razorcam dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-16 17:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from redi at gcc dot gnu dot org  2010-06-16 17:13 -------
(In reply to comment #0)
> This is obviously a major bug and it means you can't access the typedefs of the
> ISO standard library containers in order to use safe types to manipulate those
> containers, when typename is such a container.

If that was true I think someone would have noticed that by now!

As Andrew said, you need to use "typename"
This has been the case for years
http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/44559] you can't use a typedef from a typename scope in a template
  2010-06-16 16:57 [Bug c++/44559] New: you can't use a typedef from a typename scope in a template gcc at razorcam dot com
                   ` (2 preceding siblings ...)
  2010-06-16 17:13 ` [Bug c++/44559] " redi at gcc dot gnu dot org
@ 2010-06-16 17:20 ` gcc at razorcam dot com
  3 siblings, 0 replies; 5+ messages in thread
From: gcc at razorcam dot com @ 2010-06-16 17:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gcc at razorcam dot com  2010-06-16 17:20 -------
I apologize. Thanks for your quick answers.


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-16 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-16 16:57 [Bug c++/44559] New: you can't use a typedef from a typename scope in a template gcc at razorcam dot com
2010-06-16 17:04 ` [Bug c++/44559] " pinskia at gmail dot com
2010-06-16 17:04 ` [Bug c++/44559] New: " Andrew Pinski
2010-06-16 17:13 ` [Bug c++/44559] " redi at gcc dot gnu dot org
2010-06-16 17:20 ` gcc at razorcam dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).