This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/6424] [DR 339] sizeof() with overload resolution
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Aug 2004 14:58:53 -0000
- Subject: [Bug c++/6424] [DR 339] sizeof() with overload resolution
- References: <20020423071601.6424.jens.maurer@gmx.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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