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

Compound literals do not work in MSVC. #73

Open
takagi opened this issue Jun 27, 2016 · 0 comments
Open

Compound literals do not work in MSVC. #73

takagi opened this issue Jun 27, 2016 · 0 comments

Comments

@takagi
Copy link
Owner

takagi commented Jun 27, 2016

Situation
I changed to compile vector constructors to compound literals as (float3){ 0.0f, 0.0f, 0.0f }, not functions as make_float3( 0.0f, 0.0f. 0.0f ) in 9bb5706.

This change enables that global variable definitions and vector constructors are compiled to the same syntax, actually struct initializers for global variables and compound literals for vector constructors.

(defglobal x (float3 0.0 0.0 0.0))
=>
__device__ float3 x = (float3){ 0.0f, 0.0f, 0.0f };

and

(return (float3 0.0 0.0 0.0))
=>
return (float3){ 0.0f, 0.0f, 0.0f };

Problem
But it does not work on Windows because MSVC does not support compound literals (#70).

Solution
To fix this, we should treat initialization and construction as different concepts as C/C++ does.

@takagi takagi changed the title Compound literals does not work in MSVC. Compound literals do not work in MSVC. Jun 27, 2016
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

No branches or pull requests

1 participant