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: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Aug 2004 16:59:48 -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 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