Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken recvFrom on devel #19326

Closed
SirOlaf opened this issue Jan 4, 2022 · 1 comment · Fixed by #19327
Closed

Broken recvFrom on devel #19326

SirOlaf opened this issue Jan 4, 2022 · 1 comment · Fixed by #19327

Comments

@SirOlaf
Copy link
Contributor

SirOlaf commented Jan 4, 2022

recvFrom in net.nim has been broken since 4b5cecd

This line causes an issue because of invalid casting syntax for the untyped parameter 123d798b39756a95de82d119d2fe6661157ebb20407e2c394b7490e7588d2294R1630

Example to cause the problem:

import std/net
let socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
var
  buff, address: string
  port: Port
discard socket.recvFrom(buff, 0, address, port)
@rockcavera
Copy link
Contributor

I get this error when compiling:

nim c test
Hint: used config file 'D:\Nim\config\nim.cfg' [Conf]
Hint: used config file 'D:\Nim\config\config.nims' [Conf]
................................................................................................
c:\Users\Jose\Desktop\test.nim(7, 15) template/generic instantiation of `recvFrom` from here
D:\Nim\lib\pure\net.nim(1657, 26) template/generic instantiation of `adaptRecvFromToDomain` from here
D:\Nim\lib\pure\net.nim(1631, 38) Error: undeclared field: 'SockLen' for type system.int [type declared in D:\Nim\lib\system\basic_types.nim(2, 3)]

For some unknown reason the Nim compiler is assuming that the cast from int to SockLen, via dot notation, is an access of some field of an object. Does this compiler issue need further investigation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants