View Issue Details

IDProjectCategoryView StatusLast Update
0002074OpenFOAM[All Projects] Bugpublic2016-04-29 17:19
ReporterwwzhaoAssigned Tohenry 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformUnixOSOtherOS Version(please specify)
Product Version 
Fixed in Versiondev 
Summary0002074: Compilation failed when WM_LABEL_SIZE=64 is set
DescriptionWhen WM_LABEL_SIZE=64 is set, the following statement failed to compile.

List<int> l(5,0);


The error outputs:

/home/wwzhao/OpenFOAM/OpenFOAM-3.0.1/src/OpenFOAM/lnInclude/List.C: In instantiation of ‘Foam::List<T>::List(InputIterator, InputIterator) [with InputIterator = int; T = int]’:
test.C:42:20: required from here
/home/wwzhao/OpenFOAM/OpenFOAM-3.0.1/src/OpenFOAM/lnInclude/List.C:203:33: error: invalid type argument of unary ‘*’ (have ‘int’)
         this->operator[](s++) = *iter;
                                 ^
/home/wwzhao/OpenFOAM/OpenFOAM-3.0.1/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt64Opt/test.o' failed
make: *** [Make/linux64GccDPInt64Opt/test.o] Error 1
Steps To Reproduce1. source ~/OpenFOAM/OpenFOAM-3.0.1/etc/bashrc WM_LABEL_SIZE=64

2. cd $WM_PROJECT_USER_DIR

3. foamNewApp test && cd test

4. Edit test.C, add the following statement to file: List<int> l(5,0);

5. wmake
TagsNo tags attached.

Activities

wyldckat

2016-04-29 14:26

updater   ~0006188

Have you tried this:

 List<label> l(5,0);

where "label" which is the standard type for integers in OpenFOAM.

By the way, "scalar" is the standard for "double" or "float".


If you want 32-bit integers, I vaguely remember that it's "int32" in OpenFOAM: https://github.com/OpenFOAM/OpenFOAM-3.0.x/blob/master/src/OpenFOAM/primitives/ints/int32/int32.H

wwzhao

2016-04-29 14:33

reporter   ~0006189

Thank you, wyldckat. I've also tried labelList:

  labelList l(5, 0);

But it returns the same error.

When I use WM_LABEL_SIZE=32, the code compiles successfully.

henry

2016-04-29 15:27

manager   ~0006190

The presence of the Foam::List<T>::List(InputIterator, InputIterator) constructor often causes problem in 64-bit due to overloading resolution issues. I am considering removing it in OpenFOAM-dev, will let you know.

In the meantime try

List<int> l(label(5), 0);

which should be type-specific enough to help the overloading resolution.

henry

2016-04-29 17:19

manager   ~0006195

Resolved in OpenFOAM-dev by commit 064d3046b9ed363fd51bfceaecd7ba79429227b4

Issue History

Date Modified Username Field Change
2016-04-29 14:08 wwzhao New Issue
2016-04-29 14:26 wyldckat Note Added: 0006188
2016-04-29 14:33 wwzhao Note Added: 0006189
2016-04-29 15:27 henry Note Added: 0006190
2016-04-29 17:19 henry Note Added: 0006195
2016-04-29 17:19 henry Status new => resolved
2016-04-29 17:19 henry Fixed in Version => dev
2016-04-29 17:19 henry Resolution open => fixed
2016-04-29 17:19 henry Assigned To => henry