diff options
author | Jason Merrill <jason@redhat.com> | 2011-06-23 12:52:41 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-06-23 12:52:41 -0400 |
commit | ece620047b5ef8033e0c066c73c857a4d820d507 (patch) | |
tree | f52930c944813f38597dfd3a856741487b7ca3b0 /gcc | |
parent | d708df29c844a491bcb9ec44a839b0c9b0b2010f (diff) | |
download | gcc-ece620047b5ef8033e0c066c73c857a4d820d507.zip gcc-ece620047b5ef8033e0c066c73c857a4d820d507.tar.gz gcc-ece620047b5ef8033e0c066c73c857a4d820d507.tar.bz2 |
re PR c++/49395 (Non-class prvalues seem to have cv-qualification with GCC)
PR c++/49395
* init.c (build_zero_init_1): Strip cv-quals from scalar types.
From-SVN: r175339
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/init.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/ref18.C | 12 |
4 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 64a5807..a8fbf7b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-06-23 Jason Merrill <jason@redhat.com> + PR c++/49395 + * init.c (build_zero_init_1): Strip cv-quals from scalar types. + PR c++/36435 * pt.c (most_specialized_instantiation): Do check return types. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3c347a4..62b68f2 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -176,7 +176,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p, initialized are initialized to zero. */ ; else if (SCALAR_TYPE_P (type)) - init = convert (type, integer_zero_node); + init = convert (cv_unqualified (type), integer_zero_node); else if (CLASS_TYPE_P (type)) { tree field; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c1f886..dda6cff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-06-23 Jason Merrill <jason@redhat.com> + PR c++/49395 + * g++.dg/init/ref18.C: New. + PR c++/36435 * g++.dg/template/partial9.C: New. diff --git a/gcc/testsuite/g++.dg/init/ref18.C b/gcc/testsuite/g++.dg/init/ref18.C new file mode 100644 index 0000000..e704077 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/ref18.C @@ -0,0 +1,12 @@ +// PR c++/49395 + +volatile int foo(); +struct A { volatile int i; }; +typedef volatile int vi; + +volatile int i; + +const int& ir1 = foo(); +//const int& ir2 = A().i; // line 8 +const int& ir3 = static_cast<volatile int>(i); +const int& ir4 = vi(); // line 10 |