MantisBT - Open CASCADE
View Issue Details
0029299Open CASCADE[OCCT] OCCT:Foundation Classespublic2017-11-07 17:082018-06-29 21:19
kgv 
bugmaster 
normalminor 
closedfixed 
 
[OCCT] 7.3.0[OCCT] 7.3.0 
Not required
0029299: Foundation Classes, NCollection - define explicit empty constructor for map classes
Currently NCollection_Map, NCollection_DataMap define the following constructors:
  NCollection_DataMap (const Standard_Integer NbBuckets=1,
                     const Handle(NCollection_BaseAllocator)& theAllocator = 0L)

so that empty constructor is combined with initialization constructor by passing default arguments.

This may lead to broken code, when constructor is called implicitly by converting unrelated value to Standard_Integer, which is the first argument of map class constructor. In the following example, NCollection_Map::Contains (const NCollection_Map&) is called instead of NCollection_Map::Contains (const Quantity_ColorRGBA& ) because enumeration value can be used to initialize NCollection_Map() implicitly (this is for msvc10, newer compilers might put error here due to ambiguity):
NCollection_Map<Quantity_ColorRGBA, Quantity_ColorRGBAHasher> aColors;
if (aColors.Contains (Quantity_NOC_LIGHTGOLDENROD2))
{
  std::cerr << " @@ KO\n";
}
else
{
  std::cerr << " @@ OK\n";
}


Therefore, it is proposed defining explicit empty constructor and marking current constructor with explicit keyword.
N/A
No tags attached.
parent of 0029315closed bugmaster Internal compiler error after integration of the fix for bug 29299 
Issue History
2017-11-07 17:08kgvNew Issue
2017-11-07 17:08kgvAssigned To => abv
2017-11-07 17:24gitNote Added: 0072021
2017-11-07 18:41kgvNote Added: 0072022
2017-11-07 18:41kgvStatusnew => resolved
2017-11-07 18:41kgvDescription Updatedbug_revision_view_page.php?rev_id=18083#r18083
2017-11-07 21:32gitNote Added: 0072023
2017-11-09 12:06abvNote Added: 0072109
2017-11-09 12:06abvAssigned Toabv => bugmaster
2017-11-09 12:06abvStatusresolved => reviewed
2017-11-09 12:46bugmasterTest case number => Not required
2017-11-09 12:58bugmasterNote Added: 0072112
2017-11-09 12:58bugmasterStatusreviewed => tested
2017-11-10 10:13bugmasterChangeset attached => occt master b6a0525b
2017-11-10 10:13bugmasterStatustested => verified
2017-11-10 10:13bugmasterResolutionopen => fixed
2017-11-10 12:15gitNote Added: 0072159
2017-12-04 21:31kgvRelationship addedparent of 0029315
2018-02-18 00:01abvTarget Version7.4.0 => 7.3.0
2018-06-29 21:15aivFixed in Version => 7.3.0
2018-06-29 21:19aivStatusverified => closed

Notes
(0072021)
git   
2017-11-07 17:24   
Branch CR29299 has been created by kgv.

SHA-1: ab11308b3179d06e8b740d0deca8cfc258089e33


Detailed log of new commits:

Author: kgv
Date: Tue Nov 7 17:23:29 2017 +0300

    0029299: Foundation Classes, NCollection - define explicit empty constructor for map classes
    
    Ambiguous constructors have been marked with explicit keyword for classes
    NCollection_DataMap, NCollection_DoubleMap, NCollection_IndexedDataMap, NCollection_IndexedMap,
    NCollection_List, NCollection_LocalArray, NCollection_Map, NCollection_Sequence,
    NCollection_SparseArray, NCollection_UBTree,
(0072022)
kgv   
2017-11-07 18:41   
Patch is ready for review.

http://jenkins-test-10.nnov.opencascade.com/view/CR29299-master-KGV [^]
(0072023)
git   
2017-11-07 21:32   
Branch CR29299 has been updated forcibly by kgv.

SHA-1: e9eb73d35b0ed0e66ca166a3fd35801366eedf08
(0072109)
abv   
2017-11-09 12:06   
No remarks, please integrate
(0072112)
bugmaster   
2017-11-09 12:58   
Combination -
OCCT branch : CR29299 SHA-1: e9eb73d35b0ed0e66ca166a3fd35801366eedf08
Products branch : master
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Linux:
OCCT
Total CPU difference: 20701.46000000036 / 20729.730000000465 [-0.14%]
Products
Total CPU difference: 7924.590000000066 / 7934.890000000088 [-0.13%]
Windows:
OCCT
Total CPU difference: 18760.555459198367 / 18506.86663299847 [+1.37%]
Products
Total CPU difference: 8032.959492999945 / 7981.338762099939 [+0.65%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0072159)
git   
2017-11-10 12:15   
Branch CR29299 has been deleted by kgv.

SHA-1: e9eb73d35b0ed0e66ca166a3fd35801366eedf08