This revision was automatically updated to reflect the committed changes.
Closed by commit rL283995: [Sema] Handle transparent_union attributes in C mode
only (authored by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D25308?vs=74127&id=74350#toc
Repository:
rL LLVM
https://reviews.llvm.org/D25308
Files:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/test/SemaCXX/attr-gnu.cpp
Index: cfe/trunk/include/clang/Basic/Attr.td
===================================================================
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -1543,6 +1543,7 @@
let Spellings = [GCC<"transparent_union">];
// let Subjects = SubjectList<[Record, TypedefName]>;
let Documentation = [Undocumented];
+ let LangOpts = [COnly];
}
def Unavailable : InheritableAttr {
Index: cfe/trunk/test/SemaCXX/attr-gnu.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/attr-gnu.cpp
+++ cfe/trunk/test/SemaCXX/attr-gnu.cpp
@@ -27,3 +27,19 @@
void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not
known to GCC.
};
}
+
+template<typename T>
+union Tu { T b; } __attribute__((transparent_union)); // expected-warning
{{'transparent_union' attribute ignored}}
+
+template<typename T>
+union Tu2 { int x; T b; } __attribute__((transparent_union)); //
expected-warning {{'transparent_union' attribute ignored}}
+
+union Tu3 { int x; } __attribute((transparent_union)); // expected-warning
{{'transparent_union' attribute ignored}}
+
+void tuTest1(Tu<int> u); // expected-note {{candidate function not viable: no
known conversion from 'int' to 'Tu<int>' for 1st argument}}
+void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no
known conversion from 'int' to 'Tu3' for 1st argument}}
+void tu() {
+ int x = 2;
+ tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}}
+ tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}}
+}
Index: cfe/trunk/include/clang/Basic/Attr.td
===================================================================
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -1543,6 +1543,7 @@
let Spellings = [GCC<"transparent_union">];
// let Subjects = SubjectList<[Record, TypedefName]>;
let Documentation = [Undocumented];
+ let LangOpts = [COnly];
}
def Unavailable : InheritableAttr {
Index: cfe/trunk/test/SemaCXX/attr-gnu.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/attr-gnu.cpp
+++ cfe/trunk/test/SemaCXX/attr-gnu.cpp
@@ -27,3 +27,19 @@
void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC.
};
}
+
+template<typename T>
+union Tu { T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+template<typename T>
+union Tu2 { int x; T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+union Tu3 { int x; } __attribute((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+void tuTest1(Tu<int> u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu<int>' for 1st argument}}
+void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu3' for 1st argument}}
+void tu() {
+ int x = 2;
+ tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}}
+ tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits