AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage
Array of struct not allowed as parameters
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 414
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 10
Description
### Problem
Posting this as a result of [this comment](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2132#issuecomment-2521359294) made by Larry.
Not sure this is really a problem, but Larry thought it might be.
Currently this generates a compile error.
```
struct textureresource
{
string filename;
string colorspace;
};
shader test_shader
(
textureresource files[2] = {{"",""},{"",""}},
output float out = 0
)
{}
```
generates the following compile error.
```
> oslc test.osl
test.osl:9: error: array of struct are not allowed as parameters
FAILED test.osl
```
### Steps to Reproduce
1. compile code above.
### Versions
* OSL branch/version: 1.13.8
* OS: macOS
* C++ compiler:
* LLVM version: 17.0.6
* OIIO version: 2.5.9.0
Contributor guide
Research direction
Start with the test.osl reproducer and run it through oslc to inspect where the “array of struct are not allowed as parameters” diagnostic is produced. Determine from the compiler behavior and project conventions whether this parameter form should be supported; the issue does not define the expected resolution or name a test to update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100