Bug 79731

Summary: qt headers: code in <qvaluestack.h> isnt ISO C++ compatible
Product: [Retired] Red Hat Linux Reporter: Sysoltsev Slawa <vyatcheslav.sysoltsev>
Component: qtAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-19 15:37:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
Patch which doing code in <qvaluestack.h> ISO C++ compatible none

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