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++/6424] [DR 339] sizeof() with overload resolution


------- Additional Comments From bangerth at dealii dot org  2004-08-09 14:58 -------
This is getting off-topic, but maybe you have a short answer anyway: 
 
> For functions templates, the situation is radically different because 
> the expressions involved in function template declarations are part of 
> its signature.  And you can get function templates with "neighboor" 
> signatures co-existing in the same translation unit, without violating 
> the ODR.  
 
I understand that the return type is important for things like SFINAE, 
in order to decide which function to actually call. However, once this 
is decided, there needs to be exactly one instance, with a presumably 
unique signature, constants being folded or not. 
 
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. Do 
you an example where it would lead to confusion if the return expression 
would be constant folded? 
 
W. 

-- 


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


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