Bug 18743 - could not convert `x' to `const char *&'
Summary: could not convert `x' to `const char *&'
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.0
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-09 21:10 UTC by Dan Melchione
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-10-09 21:12:06 UTC
Embargoed:


Attachments (Terms of Use)
sample source (141 bytes, text/plain)
2000-10-09 21:11 UTC, Dan Melchione
no flags Details

Description Dan Melchione 2000-10-09 21:10:56 UTC
#include "stdio.h"
void test(const char *&pString) {}
int main(int argc, char* argv[])
{
    char *x = "test";
    test(x);
    return 0;
}

returns the error:
test2.cpp: In function `int main (int, char **)':
test2.cpp:6: could not convert `x' to `const char *&'
test2.cpp:2: in passing argument 1 of `test (const char *&)'

kgcc and other compilers work fine.

Comment 1 Dan Melchione 2000-10-09 21:11:57 UTC
Created attachment 3944 [details]
sample source

Comment 2 Jakub Jelinek 2000-10-09 21:37:51 UTC
There is no implicit conversion from char * to const char *&,
this testcase is really invalid.
Like the previous testcase, this is invalid already in g++ 2.95.


Note You need to log in before you can comment on or make changes to this bug.