aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slang_rs_export_type.cpp4
-rw-r--r--tests/P_static_struct/static_struct.rs11
-rw-r--r--tests/P_static_struct/stderr.txt.expect0
-rw-r--r--tests/P_static_struct/stdout.txt.expect1
4 files changed, 15 insertions, 1 deletions
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index 94bd6bb..ae13bf6 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -512,7 +512,9 @@ static bool ValidateTypeHelper(
const clang::Type *ElementType = GET_EXT_VECTOR_ELEMENT_TYPE(EVT);
if (TargetAPI < SLANG_ICS_TARGET_API &&
InCompositeType &&
- EVT->getNumElements() == 3) {
+ EVT->getNumElements() == 3 &&
+ ND &&
+ ND->getLinkage() == clang::ExternalLinkage) {
ReportTypeError(&C.getDiagnostics(), ND, NULL,
"structs containing vectors of dimension 3 cannot "
"be exported at this API level: '%0'");
diff --git a/tests/P_static_struct/static_struct.rs b/tests/P_static_struct/static_struct.rs
new file mode 100644
index 0000000..0b3e9ec
--- /dev/null
+++ b/tests/P_static_struct/static_struct.rs
@@ -0,0 +1,11 @@
+// -target-api 12
+#pragma version(1)
+#pragma rs java_package_name(com.example);
+
+typedef struct Plane_s {
+ float3 point;
+} Plane;
+
+static Plane carouselPlane = {
+ { 0.0f, 0.0f, 0.0f }
+};
diff --git a/tests/P_static_struct/stderr.txt.expect b/tests/P_static_struct/stderr.txt.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/P_static_struct/stderr.txt.expect
diff --git a/tests/P_static_struct/stdout.txt.expect b/tests/P_static_struct/stdout.txt.expect
new file mode 100644
index 0000000..9bf4e1c
--- /dev/null
+++ b/tests/P_static_struct/stdout.txt.expect
@@ -0,0 +1 @@
+Generating ScriptC_static_struct.java ...