Bug 79731 - qt headers: code in <qvaluestack.h> isnt ISO C++ compatible
Summary: qt headers: code in <qvaluestack.h> isnt ISO C++ compatible
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: qt
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2002-12-16 10:18 UTC by Sysoltsev Slawa
Modified: 2007-04-18 16:49 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2002-12-19 15:37:38 UTC

Attachments (Terms of Use)
Patch which doing code in <qvaluestack.h> ISO C++ compatible (354 bytes, patch)
2002-12-16 10:19 UTC, Sysoltsev Slawa
no flags Details | Diff

Description Sysoltsev Slawa 2002-12-16 10:18:22 UTC
Description of problem:
Look at <qvaluestack.h> header: here is template of class QValueStack<T> 
declared, which uses QValueList<T> as base class.
In line 58 of <qvaluestack.h> (body of  QValueStack<T>:pop function) is call 
for QValueList<T>::remove function. But this call is done just by name, 
i.e. remove, while full QValueList<T>::remove is needed for ISO C++ 

Look at section 14.6.2 (Dependent names), paragraph 3,4 of C++ standards:
3   In the definition of a class template or in the definition of a member of 
such a template that appears outside of the template definition, if a base 
class of this template depends on a templateparameter, the base class scope is 
not examined during name lookup until the class template is instantiated. 
      typedef double A;
      template<class T> B {
              typedef int A;
      template<class T> struct X : B<T> {
              A a; // a has type double
The type name A in the definition of X<T> binds to the typedef name defined in 
the global namespace scope, not to the typedef name defined in the base class 
B<T>. ]
4   If a base class is a dependent type, a member of that class cannot hide a 
name declared within a template, or a name from the templates enclosing 

Following standards if I have some function remove in global scope (as it 
happens, because global remove is declared in <stdio.h>), it will be assumed 
for call, and therefore arguments passed in <qvaluestack.h> wont be accepted 
for it and ISO C++ compatible compiler will generate error. GNU C++ accept very 
wide code violating for example section 14.6.2, paragraphs 3,4 of standards; 
but to increase Red Hat Linux portability you should use only standard C++ 
compatible code, especially in system headers.

For making <qvaluestack.h> ISO C++ compatible you should call remove function 
with base class prefix, i.e. as QValueList<T>::remove. Ill attach the patch 
which doing such change for qt3 package.

Version-Release number of selected component (if applicable):

How reproducible:
Every time

Steps to Reproduce:
1. You wont be able to reproduce the error because dont have strict enough 
compiler I use.
Actual results:
compilation error:
(58): error: no suitable conversion function from "QVal
ueList<int>::iterator" to "const char *far" exists
            remove( this->fromLast() );
          detected during instantiation of "T QValueStack<T>::pop() [with 

Expected results:
Successful compilation

Additional info:

Comment 1 Sysoltsev Slawa 2002-12-16 10:19:53 UTC
Created attachment 88755 [details]
Patch which doing code in <qvaluestack.h> ISO C++ compatible

Comment 2 Than Ngo 2002-12-19 15:37:38 UTC
qt-3.1.1-3 has this fix. Thanks

Note You need to log in before you can comment on or make changes to this bug.