Tuples in LDC - why it does this?
arandomonlooker
shdkahdkhhhhhii at gmail.com
Tue Jun 14 03:14:07 UTC 2022
So, i have created this program that unpacks a tuple, as a form
of error handling (betterC). An error started to pop-up. This is
a simple program that replicates it:
```
import std.typecons;
import std.meta;
Tuple!(int, int, int) iAMfunction() {
return tuple(1, 2, 3);
}
int main() {
int a, b, c;
AliasSeq!(a, b, c) = iAMfunction();
return 0;
}
```
In DMD, this program compiles. But, in LDC this displays an error
(i used Godbolt's latest versions for both compilers, and i used
betterC mode for both):
```
/opt/compiler-explorer/ldc1.29.0/ldc2-1.29.0-linux-x86_64/bin/../import/core/internal/entrypoint.d(39): Error: only one `main` allowed. Previously found `main` at <source>(8)
ASM generation compiler returned: 1
/opt/compiler-explorer/ldc1.29.0/ldc2-1.29.0-linux-x86_64/bin/../import/core/internal/entrypoint.d(39): Error: only one `main` allowed. Previously found `main` at <source>(8)
Execution build compiler returned: 1
```
This error disappears when i delete the -betterC switch from the
command invokation. Is this a bug? I'm not sure. That's why i ask
before filing a bug report.
Thank you all in advance.
More information about the digitalmars-d-ldc
mailing list