aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-18 08:25:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-18 08:25:50 +0200
commite5f47972f63702afba99c291b81ff5a61506699f (patch)
tree3737a7b830fc362b8686145e36be3fcda4dbeaa8
parent060bb7eb4d008fbd4a9fa8ef7c5e33c9e483eb52 (diff)
Work around GCC bug 86441
-rw-r--r--odb/semantics/class.cxx36
-rw-r--r--odb/validator.cxx3
2 files changed, 35 insertions, 4 deletions
diff --git a/odb/semantics/class.cxx b/odb/semantics/class.cxx
index c03de92..acecb35 100644
--- a/odb/semantics/class.cxx
+++ b/odb/semantics/class.cxx
@@ -25,11 +25,39 @@ namespace semantics
{
tree t (tree_node ());
- // TYPE_HAS_DEFAULT_CONSTRUCTOR() returns true if we have a
- // deleted default ctor. locate_ctor(), on the other hand,
- // returns NULL_TREE in this case.
+ // TYPE_HAS_DEFAULT_CONSTRUCTOR() returns true if we have a deleted
+ // default ctor. locate_ctor(), on the other hand, returns NULL_TREE in
+ // this case.
//
- return TYPE_HAS_DEFAULT_CONSTRUCTOR (t) && locate_ctor (t) != NULL_TREE;
+ if (TYPE_HAS_DEFAULT_CONSTRUCTOR (t))
+ {
+#if BUILDING_GCC_MAJOR >= 8
+
+ // Work around GCC bug 86441. Essentially, we should not trigger an
+ // instantiation or completion of the default ctor. As a result, we will
+ // assume that if we have a lazy default ctor, it is not implicitly
+ // deleted.
+ //
+ if (CLASSTYPE_LAZY_DEFAULT_CTOR (t))
+ return true;
+
+ for (ovl_iterator i (CLASSTYPE_CONSTRUCTORS (t)); i; ++i)
+ {
+ tree f (*i);
+
+ if (TREE_CODE (f) == FUNCTION_DECL && DECL_DELETED_FN (f))
+ continue;
+
+ if (default_ctor_p (f))
+ return true;
+ }
+#else
+ return locate_ctor (t) != NULL_TREE;
+#endif
+
+ }
+
+ return false;
}
bool class_::
diff --git a/odb/validator.cxx b/odb/validator.cxx
index 9c20714..bf9aa6b 100644
--- a/odb/validator.cxx
+++ b/odb/validator.cxx
@@ -1655,6 +1655,9 @@ namespace
// temporarily redirect diagnostics to /dev/null, which is
// where asm_out_file points to (see plugin.cxx).
//
+ // Needless to say, this is very hacky and we should quickly fail
+ // (as we do below) if there were errors.
+ //
int ec (errorcount);
FILE* s (global_dc->printer->buffer->stream);
global_dc->printer->buffer->stream = asm_out_file;