public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error
@ 2012-10-24 15:39 sebastian.huber@embedded-brains.de
  2012-10-24 16:06 ` [Bug c++/55058] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-24 15:39 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55058
           Summary: [4.7/4.8 Regression] Unexpected invalid type
                    conversion error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sebastian.huber@embedded-brains.de


Created attachment 28518
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28518
Sample code

The attached test file produces with "g++ -c test.cc" of GCC version 4.7 (e.g.
the one shipped with OpenSuse 12.2) and 4.8 the following output:

test.cc: In constructor 'C_DrvDataBuffer::C_DrvDataBuffer(ushort, ushort)':
test.cc:20748:34: error: invalid conversion from 'const T_SND_NODE
C_DrvSndDataBlock::* {aka const list_node<C_DrvSndDataBlock, with_lock,
oper_safe> C_DrvSndDataBlock::*}' to 'list_node<C_DrvSndDataBlock, with_lock,
oper_safe> C_DrvSndDataBlock::*' [-fpermissive]
test.cc:16667:1: error:   initializing argument 1 of 'list_base<
<template-parameter-1-1>, <template-parameter-1-2>, test_,
amp_>::list_base(const T_C_NODE_ T_::*, const char*, bool) [with T_ =
C_DrvSndDataBlock; lock_ = with_lock; test_ = oper_safe; bool amp_ = false;
list_base< <template-parameter-1-1>, <template-parameter-1-2>, test_,
amp_>::T_C_NODE_ = list_node<C_DrvSndDataBlock, with_lock, oper_safe>]'
[-fpermissive]
test.cc:20748:34: error: invalid conversion from 'const T_SND_NODE
C_DrvSndDataBlock::* {aka const list_node<C_DrvSndDataBlock, with_lock,
oper_safe> C_DrvSndDataBlock::*}' to 'list_node<C_DrvSndDataBlock, with_lock,
oper_safe> C_DrvSndDataBlock::*' [-fpermissive]
test.cc:16667:1: error:   initializing argument 1 of 'list_base<
<template-parameter-1-1>, <template-parameter-1-2>, test_,
amp_>::list_base(const T_C_NODE_ T_::*, const char*, bool) [with T_ =
C_DrvSndDataBlock; lock_ = with_lock; test_ = oper_safe; bool amp_ = false;
list_base< <template-parameter-1-1>, <template-parameter-1-2>, test_,
amp_>::T_C_NODE_ = list_node<C_DrvSndDataBlock, with_lock, oper_safe>]'
[-fpermissive]
test.cc:20748:34: error: invalid conversion from 'const T_RCV_NODE
C_DrvRcvDataBlock::* {aka const list_node<C_DrvRcvDataBlock, with_lock,
oper_safe> C_DrvRcvDataBlock::*}' to 'list_node<C_DrvRcvDataBlock, with_lock,
oper_safe> C_DrvRcvDataBlock::*' [-fpermissive]
test.cc:16667:1: error:   initializing argument 1 of 'list_base<
<template-parameter-1-1>, <template-parameter-1-2>, test_,
amp_>::list_base(const T_C_NODE_ T_::*, const char*, bool) [with T_ =
C_DrvRcvDataBlock; lock_ = with_lock; test_ = oper_safe; bool amp_ = false;
list_base< <template-parameter-1-1>, <template-parameter-1-2>, test_,
amp_>::T_C_NODE_ = list_node<C_DrvRcvDataBlock, with_lock, oper_safe>]'
[-fpermissive]

The test code can be compiled with the Comeau-Online-Compiler:

http://www.comeaucomputing.com/tryitout

The GCC 4.6 works also.


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
@ 2012-10-24 16:06 ` redi at gcc dot gnu.org
  2012-10-24 16:12 ` sebastian.huber@embedded-brains.de
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-24 16:06 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-24
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-24 16:06:13 UTC ---
can you reduce it to get rid of all the code that doesn't affect the failure?


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
  2012-10-24 16:06 ` [Bug c++/55058] " redi at gcc dot gnu.org
@ 2012-10-24 16:12 ` sebastian.huber@embedded-brains.de
  2012-10-25 11:15 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-24 16:12 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-10-24 16:12:39 UTC ---
(In reply to comment #1)
> can you reduce it to get rid of all the code that doesn't affect the failure?

I already reduced it quite a lot, but I try harder tomorrow.


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
  2012-10-24 16:06 ` [Bug c++/55058] " redi at gcc dot gnu.org
  2012-10-24 16:12 ` sebastian.huber@embedded-brains.de
@ 2012-10-25 11:15 ` rguenth at gcc dot gnu.org
  2012-10-25 11:43 ` sebastian.huber@embedded-brains.de
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-25 11:15 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.3


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (2 preceding siblings ...)
  2012-10-25 11:15 ` rguenth at gcc dot gnu.org
@ 2012-10-25 11:43 ` sebastian.huber@embedded-brains.de
  2012-10-25 12:04 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-25 11:43 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-10-25 11:43:09 UTC ---
Created attachment 28527
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28527
Reduced smaple code.

This is the offending code reduced to the minimum.  The error is no longer
present, that means the surrounding code has an effect.


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (3 preceding siblings ...)
  2012-10-25 11:43 ` sebastian.huber@embedded-brains.de
@ 2012-10-25 12:04 ` redi at gcc dot gnu.org
  2012-10-26 13:28 ` sebastian.huber@embedded-brains.de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-25 12:04 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-25 12:03:56 UTC ---
(In reply to comment #3)
> The error is no longer
> present, 

Then the attachment isn't very useful. It needs to be reduced to the minimum
that still shows the bug, otherwise it's just some code.

http://gcc.gnu.org/bugs/minimize.html


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (4 preceding siblings ...)
  2012-10-25 12:04 ` redi at gcc dot gnu.org
@ 2012-10-26 13:28 ` sebastian.huber@embedded-brains.de
  2012-10-30  9:18 ` sebastian.huber@embedded-brains.de
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-26 13:28 UTC (permalink / raw)
  To: gcc-bugs


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

Sebastian Huber <sebastian.huber@embedded-brains.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28518|0                           |1
        is obsolete|                            |
  Attachment #28527|0                           |1
        is obsolete|                            |

--- Comment #5 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-10-26 13:28:08 UTC ---
Created attachment 28537
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28537
Test case.

Thanks for the hint to the delta tool.  This is great for automatic test case
reduction.

The test code is now:

template <typename T>
struct A { };

template <typename T>
struct B {
  B(const A<T> T::* p);
  typedef A<T> D;
};

template <typename T>
B<T>::B(const D T::* p) { }

struct C {
  C() : e() {};

  const A<C> e;
};

B<C> g(&C::e);

The crucial thing is the "typedef A<T> D".  It works, if we move it before the
constructor declaration "B(const A<T> T::* p)".  Removing the constructor
definition works also.


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (5 preceding siblings ...)
  2012-10-26 13:28 ` sebastian.huber@embedded-brains.de
@ 2012-10-30  9:18 ` sebastian.huber@embedded-brains.de
  2012-11-07 15:13 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-30  9:18 UTC (permalink / raw)
  To: gcc-bugs


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

Sebastian Huber <sebastian.huber@embedded-brains.de> changed:

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

--- Comment #6 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-10-30 09:18:03 UTC ---
If I revert parts of commit 44f861fca343148a1b0720105ec2b7f14bbcc849

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1ff1c73..8f5b9f7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11015,9 +11015,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain,
tree in_decl)
             complain | tf_ignore_bad_quals);
          return r;
        }
-      else
-       /* We don't have an instantiation yet, so drop the typedef.  */
-       t = DECL_ORIGINAL_TYPE (decl);
+      /* Else we must be instantiating the typedef, so fall through.  */
     }

   if (type

mentioned in

http://gcc.gnu.org/ml/gcc/2012-10/msg00399.html

then, the test case compiles well.


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (6 preceding siblings ...)
  2012-10-30  9:18 ` sebastian.huber@embedded-brains.de
@ 2012-11-07 15:13 ` paolo.carlini at oracle dot com
  2012-12-06 16:08 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 15:13 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petschy at gmail dot com

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 15:12:52 UTC ---
*** Bug 55097 has been marked as a duplicate of this bug. ***


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (7 preceding siblings ...)
  2012-11-07 15:13 ` paolo.carlini at oracle dot com
@ 2012-12-06 16:08 ` rguenth at gcc dot gnu.org
  2012-12-07  4:55 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-06 16:08 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
           Priority|P3                          |P2


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (8 preceding siblings ...)
  2012-12-06 16:08 ` rguenth at gcc dot gnu.org
@ 2012-12-07  4:55 ` jason at gcc dot gnu.org
  2012-12-07  5:13 ` jason at gcc dot gnu.org
  2012-12-07  5:16 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  4:55 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 04:54:12 UTC ---
Author: jason
Date: Fri Dec  7 04:53:59 2012
New Revision: 194282

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194282
Log:
    PR c++/55058
    * pt.c (tsubst): Keep the quals when looking through a typedef.

Added:
    trunk/gcc/testsuite/g++.dg/template/typedef40.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (9 preceding siblings ...)
  2012-12-07  4:55 ` jason at gcc dot gnu.org
@ 2012-12-07  5:13 ` jason at gcc dot gnu.org
  2012-12-07  5:16 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  5:13 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 05:13:30 UTC ---
Author: jason
Date: Fri Dec  7 05:13:22 2012
New Revision: 194289

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194289
Log:
    PR c++/55058
    * pt.c (tsubst): Keep the quals when looking through a typedef.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/typedef40.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c


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

* [Bug c++/55058] [4.7/4.8 Regression] Unexpected invalid type conversion error
  2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
                   ` (10 preceding siblings ...)
  2012-12-07  5:13 ` jason at gcc dot gnu.org
@ 2012-12-07  5:16 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07  5:16 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 05:15:08 UTC ---
Fixed.


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

end of thread, other threads:[~2012-12-07  5:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-24 15:39 [Bug c++/55058] New: [4.7/4.8 Regression] Unexpected invalid type conversion error sebastian.huber@embedded-brains.de
2012-10-24 16:06 ` [Bug c++/55058] " redi at gcc dot gnu.org
2012-10-24 16:12 ` sebastian.huber@embedded-brains.de
2012-10-25 11:15 ` rguenth at gcc dot gnu.org
2012-10-25 11:43 ` sebastian.huber@embedded-brains.de
2012-10-25 12:04 ` redi at gcc dot gnu.org
2012-10-26 13:28 ` sebastian.huber@embedded-brains.de
2012-10-30  9:18 ` sebastian.huber@embedded-brains.de
2012-11-07 15:13 ` paolo.carlini at oracle dot com
2012-12-06 16:08 ` rguenth at gcc dot gnu.org
2012-12-07  4:55 ` jason at gcc dot gnu.org
2012-12-07  5:13 ` jason at gcc dot gnu.org
2012-12-07  5:16 ` jason at gcc dot gnu.org

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).