You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to write a class which holds two lists with two different element types fails. In the below example, if both lists contain owned A, it compiles. This is also independent of which class is used. The below example declares list a then b, and results in an error complaining about b. Switching these to declare b then a results in the same error, instead complaining about a. Changing the second definition to store nilable classes does allow it to compile.
Steps to Reproduce
Source Code:
use List;
class A {}
class B {}
class C {
var a =new list(owned A);
var b =new list(owned B);
}
proc main() {
var c =new C();
}
Compile command: chpl test.chpl
$CHPL_HOME/modules/standard/List.chpl:402: In method '_commonInitFromIterable':
$CHPL_HOME/modules/standard/List.chpl:405: error: Cannot transfer ownership from this non-nilable reference variable
$CHPL_HOME/modules/standard/List.chpl:313: called as (list(owned B,false))._commonInitFromIterable(iterable: list(owned B,false)) from method 'init='
$CHPL_HOME/modules/internal/ChapelBase.chpl:1826: called as (list(owned B,false)).init=(other: list(owned B,false))
note: generic instantiations are underlined in the above callstack
Configuration Information
Output of chpl --version:
chpl version 1.31.0 pre-release (4112d47eae)
built with LLVM version 14.0.6
available LLVM targets: amdgcn, r600, nvptx64, nvptx, aarch64_32, aarch64_be, aarch64, arm64_32, arm64, x86-64, x86
Copyright 2020-2023 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
Output of $CHPL_HOME/util/printchplenv --anonymize:
Summary of Problem
Trying to write a class which holds two lists with two different element types fails. In the below example, if both lists contain
owned A
, it compiles. This is also independent of which class is used. The below example declares lista
thenb
, and results in an error complaining aboutb
. Switching these to declareb
thena
results in the same error, instead complaining abouta
. Changing the second definition to store nilable classes does allow it to compile.Steps to Reproduce
Source Code:
Compile command:
chpl test.chpl
Configuration Information
chpl --version
:$CHPL_HOME/util/printchplenv --anonymize
:gcc --version
orclang --version
:The text was updated successfully, but these errors were encountered: