This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52521] [C++11] user defined literals and order of declaration
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Mar 2012 21:21:15 +0000
- Subject: [Bug c++/52521] [C++11] user defined literals and order of declaration
- Auto-submitted: auto-generated
- References: <bug-52521-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52521
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-09 21:21:15 UTC ---
Created attachment 26869
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26869
gcc48-pr52521.patch
If ignoring possibility of parameters with default arguments, I guess the fix
could look like this. If operator"" could have default arguments, it would
complicate things a little bit.
[over.literal]/3 lists what argument types are allowed, so IMHO it isn't
possible to have say
int operator"" _w (long double, long double = 2.0L);, but what if there is
say
int operator"" _w (const char *, std::size_t = 0);
? Can it be called for int i = 123_w; ? Though, [over.literal]/4 says that
a raw literal operator contains a single const char * argument and
[lex.ext]/{3,4} says that a raw literal operator is called for integer/floating
udlits, so perhaps it shouldn't call int operator"" _w (const char *,
std::size_t = 0); and the attached patch is sufficient.
Jason, what do you think?