This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25407] New: ICE when assigning value of variable passed to template as reference
- From: "eteran at alum dot rit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Dec 2005 06:20:13 -0000
- Subject: [Bug c++/25407] New: ICE when assigning value of variable passed to template as reference
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code produces an ICE in both gcc-3.4.4 and gcc-3.4.5, I've been
told it compiles fine in a 4.x version of the compiler.
int var1 = 0;
template <int &v> inline void get_data() { int var2; var2 = v; }
int main() {
get_data<var1>();
return 0;
}
preprocessed source is as followes:
// /usr/libexec/gcc/i686-pc-linux-gnu/3.4.5/cc1plus -quiet -D_GNU_SOURCE
test.cc -quiet -dumpbase test.cc -mtune=pentiumpro -auxbase test -Wall -W -o -
-frandom-seed=0
# 1 "test.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cc"
int var1 = 0;
template <int &v> inline void get_data() { int var2; var2 = v; }
int main() {
get_data<var1>();
return 0;
}
it produces the following output when compiled with "g++ -Wall -W test.cc -c":
test.cc: In function `void get_data() [with int&v = ((int&)(&var1))]':
test.cc:6: instantiated from here
test.cc:4: internal compiler error: in build_modify_expr, at cp/typeck.c:5190
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccNxQKpG.out file, please attach this to
your bugreport.
I am not sure if it matters, but I am running a gentoo installation, gcc was
compiled with the following CFLAGS/CXXFLAGS:
-march=pentium-m -pipe -O2
My system is running on the following kernel:
System uname: 2.6.14-gentoo-r4 i686 Intel(R) Pentium(R) M processor 2.00GHz
If there is anything else you need, I'll be more than happy to provide it.
Evan Teran
--
Summary: ICE when assigning value of variable passed to template
as reference
Product: gcc
Version: 3.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: eteran at alum dot rit dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25407