Message: previous - next
Month: April 2012

Re: [trinity-devel] k3b -bug ('K3bAudioEditorWidget::Range* r' previously declared here)

From: "David C. Rankin" <drankinatty@...>
Date: Wed, 18 Apr 2012 13:25:43 -0500
On 04/17/2012 06:22 PM, David C. Rankin wrote:
> Darrell, all
>   I'm making an attempt at fixing k3b for gcc47. If anyone else has already done
> this please stop me. It is part of bug 958.

  This is another redeclaration issue, but it is not the same type of simple
iterator issue I've seen earlier. The build of k3b fails on gcc47 with:

k3baudioeditorwidget.cpp: In member function 'virtual void
k3baudioeditorwidget.cpp:674:12: error: redeclaration of
'K3bAudioEditorWidget::Range* r'
k3baudioeditorwidget.cpp:668:14: error: 'K3bAudioEditorWidget::Range* r'
previously declared here

  It is complaining about 'r' being declared twice below. This looks more like a
reassignment than a redeclaration to me. How do we properly fix it?. If all we
care about here is 'r' having function scope, can't I just get rid of the
'Range* ' typecast following the else { ? Or do I have to change 'r' to 'not_r'
following the else?

void K3bAudioEditorWidget::mousePressEvent( TQMouseEvent* e )
  m_draggedRange = 0;
  m_draggedMarker = 0;

  bool end;
  if( Range* r = findRangeEdge( e->pos(), &end ) ) {
    m_draggedRange = r;
    m_draggingRangeEnd = end;
    setSelectedRange( r );
  else {
    Range* r = findRange( e->pos() );
    d->movedRange = r;
    d->lastMovePosition = posToMsf( e->pos().x() );
    setSelectedRange( r );
    m_draggedMarker = findMarker( e->pos() );


  As long as it is just used in mousePressEvent, can't I just do:

  else {
    r = findRange( e->pos() );

  Obviously, the compiler is taking the 'if( Range* r' as the declaration, so it
should still know what 'r' is after the else.... What say the experts...

David C. Rankin, J.D.,P.E.