Fix overly strict check for float3 in structures.
We were accidentally being too strict and generating an error for float3
in structures, even when they were not exported. This change restores the
original functionality.
Change-Id: I8f0b5881d670c37a23ca2efc575440a083befcbe
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 @@
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 ...