[Bug c++/44108] [4.6 Regression] -Wunused-but-set-variable does not consider array sizing use of a const variable

dodji at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon May 17 12:30:00 GMT 2010



------- Comment #3 from dodji at gcc dot gnu dot org  2010-05-17 12:30 -------
Created an attachment (id=20678)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20678&action=view)
Candidate patch

On Fri, May 14, 2010 at 07:25:18AM -0000, jakub at gcc dot gnu dot org wrote:
> That said, it would be good to find out why we don't warn in that
> case; for [M_CONST + 6] we do warn.

I think we don't warn in that case because M_CONST in the expression
M_CONST + 6, M_CONST is an rvalue use and we recognize it as such via
default_conversion that should be called on the arguments of the + expression.

We fail to recognize the use of [M_CONST], because M_CONST gets folded
into it's value without us marking that folding as an rvalue use. I
am thus testing the attached patch. The reason why the patch seems
convoluted is that I don't want to mark a dependant value as a rvalue
use. I believe only full instantiations should be marked.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44108



More information about the Gcc-bugs mailing list