public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32658]  New: Supposedly illegal conversion compiles without errors
@ 2007-07-06 21:43 aribrei at arcor dot de
  2007-07-06 21:44 ` [Bug c++/32658] " aribrei at arcor dot de
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: aribrei at arcor dot de @ 2007-07-06 21:43 UTC (permalink / raw)
  To: gcc-bugs

xyz::operator xyz &() gets called implicitly. I'm told that it shouldn't.

Is this intended behaviour and will it stay?

$ LC_ALL=C gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.3-20070608/configure
--prefix=/opt/unstable/gcc-4.3-20070608 --enable-languages=c,c++
--disable-multilib
Thread model: posix
gcc version 4.3.0 20070608 (experimental)


-- 
           Summary: Supposedly illegal conversion compiles without errors
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aribrei at arcor dot de
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
@ 2007-07-06 21:44 ` aribrei at arcor dot de
  2007-07-07  0:00 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: aribrei at arcor dot de @ 2007-07-06 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from aribrei at arcor dot de  2007-07-06 21:44 -------
Created an attachment (id=13857)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13857&action=view)
File that compiles unexpectedly, without warnings (no #includes)


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
  2007-07-06 21:44 ` [Bug c++/32658] " aribrei at arcor dot de
@ 2007-07-07  0:00 ` pinskia at gcc dot gnu dot org
  2007-07-07  1:46 ` aribrei at arcor dot de
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-07  0:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-07-07 00:00 -------
And why do you think it is not?
I don't have access to my copy of the standard but I think this is valid thing
to do.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
  2007-07-06 21:44 ` [Bug c++/32658] " aribrei at arcor dot de
  2007-07-07  0:00 ` pinskia at gcc dot gnu dot org
@ 2007-07-07  1:46 ` aribrei at arcor dot de
  2007-07-09 12:39 ` aribrei at arcor dot de
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: aribrei at arcor dot de @ 2007-07-07  1:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from aribrei at arcor dot de  2007-07-07 01:46 -------
I don't have a copy of the standard at all, unfortunately, but I was referred
to [12.3.2/1 p.6]. If I understood correctly, the problem being that implicit
conversions shall not take place for the class or a base class of the type.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (2 preceding siblings ...)
  2007-07-07  1:46 ` aribrei at arcor dot de
@ 2007-07-09 12:39 ` aribrei at arcor dot de
  2007-08-01 19:42 ` nathan at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: aribrei at arcor dot de @ 2007-07-09 12:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from aribrei at arcor dot de  2007-07-09 12:39 -------
I should note that I do NOT want to see this bug fixed. I would prefer to hear
that you won't "fix" it at all. So I can exploit this behavior as there is no
standards-compliant way of achieving the same results.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (3 preceding siblings ...)
  2007-07-09 12:39 ` aribrei at arcor dot de
@ 2007-08-01 19:42 ` nathan at gcc dot gnu dot org
  2007-08-02 15:56 ` widman at gimpel dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: nathan at gcc dot gnu dot org @ 2007-08-01 19:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from nathan at gcc dot gnu dot org  2007-08-01 19:42 -------
The standard is unclear about exactly why this is ill-defined.  Does the
conversion operator take part in overload resolution (and then be rejected, if
it is selected), or is it never entered into the overload set.

I shall query CWG.


-- 

nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-08-01 19:42:14
               date|                            |


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (4 preceding siblings ...)
  2007-08-01 19:42 ` nathan at gcc dot gnu dot org
@ 2007-08-02 15:56 ` widman at gimpel dot com
  2007-08-02 16:35 ` aribrei at arcor dot de
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: widman at gimpel dot com @ 2007-08-02 15:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from widman at gimpel dot com  2007-08-02 15:56 -------
(In reply to comment #4)
> I should note that I do NOT want to see this bug fixed. I would prefer to hear
> that you won't "fix" it at all. So I can exploit this behavior as there is no
> standards-compliant way of achieving the same results.

Is it possible that rvalue references will give you an alternative for the
desired effect?  See the relevant papers linked to from here:

http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2291.html


-- 

widman at gimpel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |widman at gimpel dot com


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (5 preceding siblings ...)
  2007-08-02 15:56 ` widman at gimpel dot com
@ 2007-08-02 16:35 ` aribrei at arcor dot de
  2007-08-02 17:07 ` widman at gimpel dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: aribrei at arcor dot de @ 2007-08-02 16:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from aribrei at arcor dot de  2007-08-02 16:34 -------
(In reply to comment #6)
> (In reply to comment #4)
> > I should note that I do NOT want to see this bug fixed. I would prefer to hear
> > that you won't "fix" it at all. So I can exploit this behavior as there is no
> > standards-compliant way of achieving the same results.
> 
> Is it possible that rvalue references will give you an alternative for the
> desired effect?  See the relevant papers linked to from here:
> 
> http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2291.html
> 

This would mean that instead of A::A(A &), I wrote A::A(A &&) and passing
temporaries would automatically work?

(Not sure if I correctly understand the r-value reference proposal.)


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (6 preceding siblings ...)
  2007-08-02 16:35 ` aribrei at arcor dot de
@ 2007-08-02 17:07 ` widman at gimpel dot com
  2007-08-02 17:17 ` widman at gimpel dot com
  2007-08-02 18:39 ` aribrei at arcor dot de
  9 siblings, 0 replies; 12+ messages in thread
From: widman at gimpel dot com @ 2007-08-02 17:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from widman at gimpel dot com  2007-08-02 17:07 -------
(In reply to comment #7)
> (In reply to comment #6) 
> > Is it possible that rvalue references will give you an alternative for the
> > desired effect?  See the relevant papers linked to from here:
> > 
> > http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2291.html
> > 
> 
> This would mean that instead of A::A(A &), I wrote A::A(A &&) and passing
> temporaries would automatically work?

That's correct.  Rvalues  would bind directly to the 'A&&' parameter; you could
even have two ctors:
struct A {
 A(const A&);   // copy ctor
 A(A&&);          // move ctor
};
...and when you initialize an 'A' with an rvalue, overload resolution will
select the move ctor.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (7 preceding siblings ...)
  2007-08-02 17:07 ` widman at gimpel dot com
@ 2007-08-02 17:17 ` widman at gimpel dot com
  2007-08-02 18:39 ` aribrei at arcor dot de
  9 siblings, 0 replies; 12+ messages in thread
From: widman at gimpel dot com @ 2007-08-02 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from widman at gimpel dot com  2007-08-02 17:17 -------
See also: 

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

So it seems you should be able to play with it now.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
  2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
                   ` (8 preceding siblings ...)
  2007-08-02 17:17 ` widman at gimpel dot com
@ 2007-08-02 18:39 ` aribrei at arcor dot de
  9 siblings, 0 replies; 12+ messages in thread
From: aribrei at arcor dot de @ 2007-08-02 18:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from aribrei at arcor dot de  2007-08-02 18:39 -------
(In reply to comment #9)
> See also: 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29939
> 
> So it seems you should be able to play with it now.
> 

Unfortunately, I have to support older GCC version (like 4.0 and 4.1) for now.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/32658] Supposedly illegal conversion compiles without errors
       [not found] <bug-32658-4@http.gcc.gnu.org/bugzilla/>
@ 2012-08-22 20:56 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-22 20:56 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|gcc-bugs at gcc dot gnu.org |

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-22 20:56:01 UTC ---
Nathan, shall we close this?


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-08-22 20:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-06 21:43 [Bug c++/32658] New: Supposedly illegal conversion compiles without errors aribrei at arcor dot de
2007-07-06 21:44 ` [Bug c++/32658] " aribrei at arcor dot de
2007-07-07  0:00 ` pinskia at gcc dot gnu dot org
2007-07-07  1:46 ` aribrei at arcor dot de
2007-07-09 12:39 ` aribrei at arcor dot de
2007-08-01 19:42 ` nathan at gcc dot gnu dot org
2007-08-02 15:56 ` widman at gimpel dot com
2007-08-02 16:35 ` aribrei at arcor dot de
2007-08-02 17:07 ` widman at gimpel dot com
2007-08-02 17:17 ` widman at gimpel dot com
2007-08-02 18:39 ` aribrei at arcor dot de
     [not found] <bug-32658-4@http.gcc.gnu.org/bugzilla/>
2012-08-22 20:56 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).