This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 79731 - qt headers: code in <qvaluestack.h> isn’t ISO C++ compatible
qt headers: code in <qvaluestack.h> isn’t ISO C++ compatible
Product: Red Hat Linux
Classification: Retired
Component: qt (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2002-12-16 05:18 EST by Sysoltsev Slawa
Modified: 2007-04-18 12:49 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-12-19 10:37:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Sysoltsev Slawa 2002-12-16 05:18:22 EST
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 template’s enclosing 
scopes. …”

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> won’t 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’. I’ll 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 won’t be able to reproduce the error because don’t 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 05:19:53 EST
Created attachment 88755 [details]
Patch which doing code in <qvaluestack.h> ISO C++ compatible
Comment 2 Ngo Than 2002-12-19 10:37:38 EST
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.