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

Generated @compileError missing semicolon #4983

Closed
Diltsman opened this issue Apr 9, 2020 · 2 comments
Closed

Generated @compileError missing semicolon #4983

Diltsman opened this issue Apr 9, 2020 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. translate-c C to Zig source translation feature (@cImport)
Milestone

Comments

@Diltsman
Copy link

Diltsman commented Apr 9, 2020

Using the latest build (4/8/2020), I have the following code:

const std = @import("std");
const win = @cImport({
    @cInclude("Windows.h");
});

pub fn main() !void {
    win.RegisterClassExW(null);
}

I get the following error:

.\zig-cache\o\efzXXrvTXf_gcKIyG0QKyGyJzfaNgN3EfbmS5AgR30pazMyD5dL_X5pwmr5JQ2gi\cimport.zig:7346:1: error: expected token ';', found 'pub'
pub const NtCurrentTeb = @compileError("unable to translate function"); // C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\..\um\winnt.h:22627:1
^
ZigVulkan...The following command exited with error code 1:
C:\Users\dilts\OneDrive\Documents\Zig\zig\zig.exe build-exe C:\Users\dilts\OneDrive\Documents\Zig\ZigVulkan\src\main.zig --library c --cache-dir C:\Users\dilts\OneDrive\Documents\Zig\ZigVulkan\zig-cache --name ZigVulkan --cache on

Build failed. The following command failed:
C:\Users\dilts\OneDrive\Documents\Zig\ZigVulkan\zig-cache\o\_2fabpGegvT2pO8VBD-7V745YChbDKh-cqkT-SfNCQecmkGN2Qm4DPWKn05igJ0c\build.exe C:\Users\dilts\OneDrive\Documents\Zig\zig\zig.exe C:\Users\dilts\OneDrive\Documents\Zig\ZigVulkan C:\Users\dilts\OneDrive\Documents\Zig\ZigVulkan\zig-cache

At the location that the error is occurring, the surrounding lines are:

pub const PTP_IO = ?*struct__TP_IO;
pub const GetCurrentFiber = @compileError("unable to translate function")
pub const NtCurrentTeb = @compileError("unable to translate function");

Note that the second line is missing a trailing semicolon, and that is the cause of the build error.

@FireFox317
Copy link
Contributor

Duplicate of #3453

@andrewrk andrewrk added this to the 0.7.0 milestone Apr 9, 2020
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. translate-c C to Zig source translation feature (@cImport) labels Apr 9, 2020
@haoyu234 haoyu234 mentioned this issue Apr 13, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Aug 13, 2020
@Vexu
Copy link
Member

Vexu commented Feb 25, 2021

Fixed by #7479.

@Vexu Vexu closed this as completed Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. translate-c C to Zig source translation feature (@cImport)
Projects
None yet
Development

No branches or pull requests

4 participants