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++/17011] [3.4/3.5 regression] invalid default parameter diagnosed too late


------- Additional Comments From bangerth at dealii dot org  2004-08-12 21:12 -------
I had to do some research when discussing a bug within IBM's xlC compiler a week ago, 
and here simply paste a piece from a mail to them that also seems relevant in the 
present context: 
----------------------------------- 
However, here's the catch: let's assume that we may cause an implicit  
instantiation. Then, 14.7.1/1 says: "The implicit instantiation of a class  
template specialization causes the instantiation of the declarations, but  
not of the definitions or default arguments...".  
 
Furthermore, 14.7.2 says: "Unless a call is to a [...] member function of  
an explicitly specialized class template, a default argument for a [...]  
member function of a class template is implicitly instantiated when the  
function is called in a context that requires the value of the default  
argument." 
 
Additionally, 14.7.1/11 indicates to me that default arguments are only  
evaluated at the point where they are actually used. 
----------------------------------- 
 
This all may or may not be imminent here, but it at least points to the right paragraphs 
that state when exactly a default argument shall be evaluated. 
 
W. 

-- 


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


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