summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-08 15:12:23 (GMT)
committerBrad King <brad.king@kitware.com>2014-04-09 20:43:27 (GMT)
commit7f62b3ae7ba4ada760b1f519e2c70569b02b84d0 (patch)
treee000d3effe2d7356aaa26ba077ee5fa9e6d75cf2
parent44a6a6db4a918490061b35bbb24316e14bd0bf6f (diff)
downloadCastXML-7f62b3ae7ba4ada760b1f519e2c70569b02b84d0.zip
CastXML-7f62b3ae7ba4ada760b1f519e2c70569b02b84d0.tar.gz
CastXML-7f62b3ae7ba4ada760b1f519e2c70569b02b84d0.tar.bz2
test: Show failure when implicit member needs bad template instantiation
When a function template (or member of a class template) is instantiated by an implicit class member definition, Clang delays the instantiation for later handling by clang::Sema::PerformPendingInstantiations during clang::Sema::ActOnEndOfTranslationUnit. If the instantiation causes errors they are not suppressed because our clang::Sema::SFINAETrap has gone out of scope. Even if we could keep a clang::Sema::SFINAETrap in scope, the clang::Sema::InstantiatingTemplate::Initialize method sets sema.InNonInstantiationSFINAEContext to false and adds an entry to sema.ActiveTemplateInstantiations. This prevents the clang::Sema::EmitCurrentDiagnostic call to isSFINAEContext from returning a valid SFINAE context, so errors are still not suppressed. Add a test case demonstrating this known failure, and mark it as "broken". This will require changes to Clang to fix.
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/expect/gccxml.broken.Class-implicit-member-bad-base-result.txt1
-rw-r--r--test/expect/gccxml.broken.Class-implicit-member-bad-base-stderr.txt2
-rw-r--r--test/expect/gccxml.broken.Class-implicit-member-bad-base-stdout.txt1
-rw-r--r--test/input/Class-implicit-member-bad-base.cxx9
5 files changed, 14 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f386e41..11110ee 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -163,5 +163,6 @@ castxml_test_gccxml_c(Typedef-called-class)
castxml_test_gccxml_c(invalid)
+castxml_test_gccxml_broken(Class-implicit-member-bad-base)
castxml_test_gccxml_broken(Class-template-constructor-template)
castxml_test_gccxml_broken(ReferenceType-to-Class-template)
diff --git a/test/expect/gccxml.broken.Class-implicit-member-bad-base-result.txt b/test/expect/gccxml.broken.Class-implicit-member-bad-base-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/gccxml.broken.Class-implicit-member-bad-base-result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/gccxml.broken.Class-implicit-member-bad-base-stderr.txt b/test/expect/gccxml.broken.Class-implicit-member-bad-base-stderr.txt
new file mode 100644
index 0000000..7f45214
--- /dev/null
+++ b/test/expect/gccxml.broken.Class-implicit-member-bad-base-stderr.txt
@@ -0,0 +1,2 @@
+.*/test/input/Class-implicit-member-bad-base.cxx:6:16: error: read-only variable is not assignable
+.*/test/input/Class-implicit-member-bad-base.cxx:9:7: note: in instantiation of member function 'base<const int>::operator=' requested here
diff --git a/test/expect/gccxml.broken.Class-implicit-member-bad-base-stdout.txt b/test/expect/gccxml.broken.Class-implicit-member-bad-base-stdout.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/test/expect/gccxml.broken.Class-implicit-member-bad-base-stdout.txt
@@ -0,0 +1 @@
+^$
diff --git a/test/input/Class-implicit-member-bad-base.cxx b/test/input/Class-implicit-member-bad-base.cxx
new file mode 100644
index 0000000..0a69e73
--- /dev/null
+++ b/test/input/Class-implicit-member-bad-base.cxx
@@ -0,0 +1,9 @@
+template <typename T> class base {
+protected:
+ T data;
+ base();
+ void operator=(base const& a) {
+ this->data = a.data;
+ }
+};
+class start: public base<int const> {};