[Bug c++/6424] [DR 339] sizeof() with overload resolution

gdr at integrable-solutions dot net gcc-bugzilla@gcc.gnu.org
Mon Aug 9 16:59:00 GMT 2004


------- Additional Comments From gdr at integrable-solutions dot net  2004-08-09 16:59 -------
Subject: Re:  [DR 339] sizeof() with overload resolution

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:

| (In reply to comment #9)
| 
| > For example, this code is valid: 
| > ----------------- 
| > template <int> struct S {}; 
| >  
| > template <typename T> 
| > S<sizeof(T)> foo (T); 
| >  
| > template <typename T> 
| > S<sizeof(T)*2/2> foo (T); 
| > ----------------- 
| > However, when you want to call these functions, you get an ambiguity. 
| 
| Yes, but you must be able to define those two functions in two different 
| translation units, instantiate them, and link the whole program without getting 
| a symbol conflict.

Indeed.

| > Do you an example where it would lead to confusion if the return expression 
| > would be constant folded? 
| 
| Last time I asked this to Mark, the explanation was that it was too hard to 
| describe *exactly* in the ABI specification what had to be folded and what had 
| not.

Yes, the issue boils down to find normal forms for C++ expressions,
without introducing ODR violation where they do not exist.

-- Gaby


-- 


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



More information about the Gcc-bugs mailing list