Bug 89518 - Type misinterpreted as int& instead of const int&
Summary: Type misinterpreted as int& instead of const int&
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 9
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-23 18:43 UTC by Mark Goodman
Modified: 2007-04-18 16:53 UTC (History)
0 users

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


Attachments (Terms of Use)

Description Mark Goodman 2003-04-23 18:43:54 UTC
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 22:17:13 UTC
Fixed in gcc-3.3.2-1.


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