This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: Implement type-computation for non-dependent expressions


Mark Mitchell wrote:
> 2003-07-08  Mark Mitchell  <mark@codesourcery.com>
>	:
>	* typeck.c (cxx_sizeof_or_alignof_type): Give the expression
>	type size_t, even in templates.
>	(expr_sizeof): Likewise.
>	(finish_class_member_access_expr): Handle non-dependent expressions
>	correctly.
>	(build_x_indirect_ref): Likewise.
>	(build_x_binary_op): Likewise.
>	(build_x_unary_op): Likewise.
>	(build_x_conditional_expr): Likewise.
>	(build_x_compound_expr): Likewise.
>	* typeck2.c (build_x_arrow): Likewise.

It seems this patch (or a related one, but this had a hit for `cvs
annotate`) broke the following example, when compiled with -W or -Wall:

  extern "C" void FormatDisk();

  template <class T>
  struct C {
    C(){ FormatDisk(), 0; }
  };

  template <class T>
  void f() { FormatDisk(), 0; }

  void g() { FormatDisk(), 0; }

where I now get the following:

  y.cc: In constructor `C<T>::C()':
  y.cc:5: warning: left-hand operand of comma expression has no effect
  y.cc: In function `void f()':
  y.cc:9: warning: left-hand operand of comma expression has no effect

I'm sure you agree with me that formatting the hard disk _is_ an effect,
don't you? :->

Gerald

PS: This bug only happens inside a template class or a template function,
but not inside a regular function. (I originally encountered a variation
thereof in Solaris 9 system headers, and it took me quite a bit to isolate
it.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]