Bug 89518 - Type misinterpreted as int& instead of const int&
Type misinterpreted as int& instead of const int&
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-23 14:43 EDT by Mark Goodman
Modified: 2007-04-18 12:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-03 18:17:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mark Goodman 2003-04-23 14:43:54 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312

Description of problem:
gcc refuses to compile the following code:

template <class T>
void test(T t) {
  int x = 0;
  const typeof(x) & t1 = x+0;
}

int main(int argc, char **argv) {
  test(0);
  return 0;
}


Version-Release number of selected component (if applicable):
gcc-3.2.2-5

How reproducible:
Always

Steps to Reproduce:
1. gcc -c test.cc -o test
2.
3.
    

Actual Results:

test.cc: In function `void test(T) [with T = int]':
test.cc:8:   instantiated from here
test.cc:4: initialization of non-const reference type `int&' from rvalue of 
   type `int'

Expected Results:  


Additional info:

This happens in gcc-3_2-branch as well.
Comment 1 Richard Henderson 2004-10-03 18:17:13 EDT
Fixed in gcc-3.3.2-1.

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