This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] libstdc++/67066 disable concept checks for C++11 and up


This fixes a bootstrap failure with --enable-concept-checks, caused by
the Filesystem code (built as C++14) not meeting the C++03 concept
requirements for containers.

I think building with --enable-concept-checks is crazy nowadays but
this at least makes it possible.

Rather than trying to fix the concept checks to understand move-only
types I'm just disabling the relevant checks in C++11 mode.

Tested powerpc64le-linux, committing to trunk.

commit cdb1515df059a1dadddf0121d0d8163ee50b3cf4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 18 11:21:37 2015 +0100

    	PR libstdc++/67066
    	* doc/xml/manual/configure.xml (manual.intro.setup.configure): Add
    	caveats for --enable-concept-checks. Improve link text.
    	* doc/xml/manual/diagnostics.xml (std.diagnostics.concept_checking):
    	Clarify caveats.
    	* doc/html/*: Regenerate.
    	* include/bits/stl_deque.h (deque): Only use concept checks in C++03.
    	* include/bits/stl_stack.h (stack): Likewise.
    	* include/bits/stl_vector.h (vector): Likewise.

diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc/xml/manual/configure.xml
index a76b80c..2f558d2 100644
--- a/libstdc++-v3/doc/xml/manual/configure.xml
+++ b/libstdc++-v3/doc/xml/manual/configure.xml
@@ -288,10 +288,12 @@
 
  <varlistentry><term><code>--enable-concept-checks</code></term>
  <listitem><para>This turns on additional compile-time checks for instantiated
-	library templates, in the form of specialized templates,
-	<link linkend="std.diagnostics.concept_checking">described here</link>.  They
+	library templates, in the form of specialized templates described in
+        the <link linkend="std.diagnostics.concept_checking">Concept
+        Checking</link> section.  They
 	can help users discover when they break the rules of the STL, before
-	their programs run.
+	their programs run. These checks are based on C++03 rules and some of
+	them are not compatible with correct C++11 code.
      </para>
  </listitem></varlistentry>
 
diff --git a/libstdc++-v3/doc/xml/manual/diagnostics.xml b/libstdc++-v3/doc/xml/manual/diagnostics.xml
index 99206e9..88ed2e2 100644
--- a/libstdc++-v3/doc/xml/manual/diagnostics.xml
+++ b/libstdc++-v3/doc/xml/manual/diagnostics.xml
@@ -114,8 +114,9 @@
 
  <para>
    Please note that the checks are based on the requirements in the original
-   C++ standard, some of which have changed in the new C++11 revision.
-   Additionally, some correct code might be rejected by the concept checks,
+   C++ standard, many of which were relaxed in the C++11 standard and so valid
+   C++11 code may be incorrectly rejected by the concept checks.  Additionally,
+   some correct C++03 code might be rejected by the concept checks,
    for example template argument types may need to be complete when used in
    a template definition, rather than at the point of instantiation.
    There are no plans to address these shortcomings.
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index 50570ef..f674245 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -829,7 +829,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     {
       // concept requirements
       typedef typename _Alloc::value_type        _Alloc_value_type;
+#if __cplusplus < 201103L
       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+#endif
       __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
 
       typedef _Deque_base<_Tp, _Alloc>			_Base;
diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h
index 0ed212e..09dd611 100644
--- a/libstdc++-v3/include/bits/stl_stack.h
+++ b/libstdc++-v3/include/bits/stl_stack.h
@@ -100,8 +100,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       // concept requirements
       typedef typename _Sequence::value_type _Sequence_value_type;
+#if __cplusplus < 201103L
       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
       __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
+#endif
       __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
 
       template<typename _Tp1, typename _Seq1>
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index 8407a15..305d446 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -215,7 +215,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     {
       // Concept requirements.
       typedef typename _Alloc::value_type                _Alloc_value_type;
+#if __cplusplus < 201103L
       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+#endif
       __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
       
       typedef _Vector_base<_Tp, _Alloc>			 _Base;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]