public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44122]  New: Confusing error: cannot convert 'T*’ to ‘T*’
@ 2010-05-13 18:53 ppluzhnikov at google dot com
  2010-05-15  0:16 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' manu at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2010-05-13 18:53 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]

Here is the complete error message:

g++ -c t.cc
t.cc: In function ‘int bar()’:
t.cc:8:18: error: cannot convert ‘Py_ssize_t*’ to ‘Py_ssize_t*’ for argument
‘1’ to ‘int foo(Py_ssize_t*)’

How is that even possible?

cat t.cc
typedef long Py_ssize_t;

int foo(Py_ssize_t *);

int bar() {
  typedef int Py_ssize_t;
  Py_ssize_t pos;
  return foo(&pos);
}

Suggested improvement:

t.cc:8: error: cannot convert '{bar}::Py_ssize_t* [int*]' to 'Py_ssize_t*
[long*]' for 1st argument to 'int foo(Py_ssize_t*)'


-- 
           Summary: Confusing error: cannot convert 'T*’ to ‘T*’
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ppluzhnikov at google dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*'
  2010-05-13 18:53 [Bug c++/44122] New: Confusing error: cannot convert 'T*’ to ‘T*’ ppluzhnikov at google dot com
@ 2010-05-15  0:16 ` manu at gcc dot gnu dot org
  2010-05-15  0:47 ` redi at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-05-15  0:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from manu at gcc dot gnu dot org  2010-05-15 00:16 -------
Have you tried with Clang?

I think Clang prints typedefs using 'aka', which is not very clear.

error: incompatible type assigning 'vector<Real>', expected 'std::string' (aka
'class std::basic_string<char>')

I would suggest:

t.cc:8: error: cannot convert 'bar::Py_ssize_t*' ('int*') to 'Py_ssize_t*'
('long*') for 1st argument to 'int foo(Py_ssize_t*)'

Do we have typedef unwrapping?


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-05-15 00:16:20
               date|                            |


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


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

* [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*'
  2010-05-13 18:53 [Bug c++/44122] New: Confusing error: cannot convert 'T*’ to ‘T*’ ppluzhnikov at google dot com
  2010-05-15  0:16 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' manu at gcc dot gnu dot org
@ 2010-05-15  0:47 ` redi at gcc dot gnu dot org
  2010-05-15  0:55 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-05-15  0:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from redi at gcc dot gnu dot org  2010-05-15 00:47 -------
(In reply to comment #1)
> Have you tried with Clang?
> 
> I think Clang prints typedefs using 'aka', which is not very clear.
> 
> error: incompatible type assigning 'vector<Real>', expected 'std::string' (aka
> 'class std::basic_string<char>')
> 
> I would suggest:
> 
> t.cc:8: error: cannot convert 'bar::Py_ssize_t*' ('int*') to 'Py_ssize_t*'
> ('long*') for 1st argument to 'int foo(Py_ssize_t*)'

1) bar:: looks like valid C++ syntax but it is not a valid
nested-name-specifier, so it should be something that is not valid C++ syntax,
such as {bar}::Py_ssize_t

2) Although the quotes _should_ make it clear, I think that could get confusing
when the type involves parentheses, e.g.

cannot convert 'my_fun_type' ('int* (Foo::*)(char*)') to 'int* const
(Foo::*)(char*)'

How about adding "typedef for" in there? e.g.

cannot convert 'bar::Py_ssize_t*' (typedef for 'int*')


> Do we have typedef unwrapping?

We used to only have unwrapped typedefs, so hopefully we can still get it when
wanted!


-- 


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


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

* [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*'
  2010-05-13 18:53 [Bug c++/44122] New: Confusing error: cannot convert 'T*’ to ‘T*’ ppluzhnikov at google dot com
  2010-05-15  0:16 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' manu at gcc dot gnu dot org
  2010-05-15  0:47 ` redi at gcc dot gnu dot org
@ 2010-05-15  0:55 ` manu at gcc dot gnu dot org
  2010-05-15  0:59 ` ppluzhnikov at google dot com
  2010-07-24 21:17 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' (when T are different scopes) pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-05-15  0:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2010-05-15 00:55 -------
(In reply to comment #2)
> 
> 1) bar:: looks like valid C++ syntax but it is not a valid
> nested-name-specifier, so it should be something that is not valid C++ syntax,
> such as {bar}::Py_ssize_t

True, but {bar}:: is still confusing. If someone does a patch with that, so be
it, but I would prefer a different syntax. Or even two extra notes like:

t.cc: 7: note: 'Py_ssize_t*' (typedef for 'int*') defined here.
t.cc: 1: note: 'Py_ssize_t*' (typedef for 'long*') defined here.

so it is easy to jump to the definitions.

> 2) Although the quotes _should_ make it clear, I think that could get confusing
> 
> How about adding "typedef for" in there? e.g.
> 
> cannot convert 'bar::Py_ssize_t*' (typedef for 'int*')

Perfect!


-- 


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


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

* [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*'
  2010-05-13 18:53 [Bug c++/44122] New: Confusing error: cannot convert 'T*’ to ‘T*’ ppluzhnikov at google dot com
                   ` (2 preceding siblings ...)
  2010-05-15  0:55 ` manu at gcc dot gnu dot org
@ 2010-05-15  0:59 ` ppluzhnikov at google dot com
  2010-07-24 21:17 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' (when T are different scopes) pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2010-05-15  0:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ppluzhnikov at google dot com  2010-05-15 00:59 -------
For reference, here is what clang currently prints (I am told):

t.cc:8:9: error: no matching function for call to 'foo'
 return foo(&pos);
        ^~~
t.cc:3:5: note: candidate function not viable: no known conversion from
'Py_ssize_t *' (aka 'int *') to 'Py_ssize_t *' (aka 'long *') for 1st argument
 int foo(Py_ssize_t *);
   ^
1 error generated.

I do like both the 'typedef for', and the extra notes ideas.


-- 


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


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

* [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' (when T are different scopes)
  2010-05-13 18:53 [Bug c++/44122] New: Confusing error: cannot convert 'T*’ to ‘T*’ ppluzhnikov at google dot com
                   ` (3 preceding siblings ...)
  2010-05-15  0:59 ` ppluzhnikov at google dot com
@ 2010-07-24 21:17 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-24 21:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
  GCC build triplet|x86_64-unknown-linux-gnu    |
   GCC host triplet|x86_64-unknown-linux-gnu    |
 GCC target triplet|x86_64-unknown-linux-gnu    |
            Summary|Confusing error: cannot     |Confusing error: cannot
                   |convert 'T*' to 'T*'        |convert 'T*' to 'T*' (when T
                   |                            |are different scopes)


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


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

* [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' (when T are different scopes)
       [not found] <bug-44122-4@http.gcc.gnu.org/bugzilla/>
@ 2014-07-20 20:53 ` ppluzhnikov at google dot com
  0 siblings, 0 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2014-07-20 20:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44122

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
GCC output @r212875:

svn-r212875/bin/g++ -c t.cc

t.cc: In function ‘int bar()’:
t.cc:8:18: error: cannot convert ‘Py_ssize_t* {aka int*}’ to ‘Py_ssize_t* {aka
long int*}’ for argument ‘1’ to ‘int foo(Py_ssize_t*)’
   return foo(&pos);
                  ^
>From gcc-bugs-return-456823-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jul 20 20:56:28 2014
Return-Path: <gcc-bugs-return-456823-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4811 invoked by alias); 20 Jul 2014 20:56:26 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 4378 invoked by uid 48); 20 Jul 2014 20:56:17 -0000
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59832] [c++11] ICE in reshape_init_class with initializer list
Date: Sun, 20 Jul 2014 20:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ppluzhnikov at google dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59832-4-bG2oA8fYjY@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59832-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59832-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg01414.txt.bz2
Content-length: 147

https://gcc.gnu.org/bugzilla/show_bug.cgi?idY832

--- Comment #6 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
Still broken @r212875


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

end of thread, other threads:[~2014-07-20 20:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-13 18:53 [Bug c++/44122] New: Confusing error: cannot convert 'T*’ to ‘T*’ ppluzhnikov at google dot com
2010-05-15  0:16 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' manu at gcc dot gnu dot org
2010-05-15  0:47 ` redi at gcc dot gnu dot org
2010-05-15  0:55 ` manu at gcc dot gnu dot org
2010-05-15  0:59 ` ppluzhnikov at google dot com
2010-07-24 21:17 ` [Bug c++/44122] Confusing error: cannot convert 'T*' to 'T*' (when T are different scopes) pinskia at gcc dot gnu dot org
     [not found] <bug-44122-4@http.gcc.gnu.org/bugzilla/>
2014-07-20 20:53 ` ppluzhnikov at google 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).