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++/17391] [3.3 regression] template parameter accepted on typedef name


------- Additional Comments From gdr at integrable-solutions dot net  2004-09-10 13:43 -------
Subject: Re:  [3.3 regression] template parameter accepted on typedef name

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| By the way, if someone wonders what the compiler is actually doing 
| here: for this code 
| ------------------- 
| template<typename> struct foo { foo();}; 
|  
| int main() { 
|   typedef foo<int> bar; 
|   bar<double> baz; 
| } 
| ------------------- 
| we get these symbols: 
| g/x> /home/bangerth/bin/gcc-3.3*/bin/c++ -c x.cc 
| g/x> nm -C x.o 
|          U __gxx_personality_v0 
| 00000000 T main 
|          U foo<double>::foo() 
|  
| So, lo and behold, the compiler uses the spurious "double" template 
| argument, rather than the "int" passed to the typedef. Very interesting... 

Ouch!

This might be related to our failure to enforce "kind" of names before
use or declarations.

-- Gaby


-- 


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


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