Skip to content

[aarch64] clang compile error, when compile a C file, however succeess when rename the file to cpp #139033

Open
@scoutzeng

Description

@scoutzeng

clang version: 19.1.1
cmake version: 4.0.1
visual studio pro 17 2022
I'm going to compile a helloworld program main.c

#include <stdio.h>
#include <arm_neon.h>

int main() {
	int64x2_t a = { 1,2 };
	const int b = 1;
	int64x2_t res = vshlq_n_s64(a, b);
	return 0;
}

on x64 windows platform, i use cmake -S ../src -B . -G "Visual Studio 17 2022" -A ARM64 cmake --build . commands to compile, however compiler output an error error C2057: expected constant expression. After that i just change the main.c to main.cpp, then everythig is ok. I just wonder what happend? why i can't name it as a C file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions