Issue 143734
Summary Structures that were not declared as "export" were abnormally exported
Labels new issue
Assignees
Reporter hexne
    /// bp.cppm
```
module;
#include <memory>
#include <vector>
export module bp;

struct Layer {  
    void forward(int) {  }
};

export class BP {
 std::vector<std::shared_ptr<Layer>> layers_;
};
```

/// cnn.cppm
```
module;
#include <memory>
#include <vector>
export module cnn;

import bp;

struct Layer { 
    void forward() { }
};

export
class CNN {
    std::vector<std::shared_ptr<Layer>> layouts_;
};
```

command:
```
clang++ -std=c++20 --precompile bp.cppm -o bp.pcm
clang++ -std=c++20 --precompile cnn.cppm -o cnn.pcm -fprebuilt-module-path=.
```

error message:
```
cnn.cppm:8:8: error: declaration 'Layer' attached to named module 'cnn' cannot be attached to other modules
    8 | struct Layer { 
      | ^
/home/hexne/Projects/modforge/bp.cppm:6:8: note: also found
    6 | struct Layer {  
      | ^
/home/hexne/Projects/modforge/bp.cppm:7:10: error: 'Layer::forward' from module 'bp' is not present in definition of 'Layer' provided earlier
    7 | void forward(int) {  }
      |          ^
cnn.cppm:9:10: note: declaration of 'forward' does not match
    9 |     void forward() {  }
 |          ^
2 errors generated.

```


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to