Bug 24937 - "default initialization of an object of const type without a user-provided default constructor" is not checked at configure time
Summary: "default initialization of an object of const type without a user-provided de...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 8.2.1
: P2 normal
Target Milestone: 9.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-25 18:22 UTC by giuliomoro
Modified: 2020-01-07 16:51 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description giuliomoro 2019-08-25 18:22:58 UTC
This happened while building on MacOS 10.11.6, where g++ is actually Apple LLVM version 8.0.0 (clang-800.0.42.1). Configuration was all fine, and part of the build also went well. However, partway into building, this results in:




make[3]: Leaving directory '/Volumes/untitled/openadk/toolchain_build_beaglebone-black_uclibc-ng_cortex_a8_hard_eabihf_arm/w-gdb-8.2.1-1/gdb-8.2.1-obj/gdb'
  CXX    stap-probe.o
/Volumes/untitled/openadk/toolchain_build_beaglebone-black_uclibc-ng_cortex_a8_hard_eabihf_arm/w-gdb-8.2.1-1/gdb-8.2.1/gdb/stap-probe.c:122:29: error: default initialization of an
      object of const type 'const stap_static_probe_ops' without a user-provided default constructor
const stap_static_probe_ops stap_static_probe_ops;
                            ^
                                                 {}
1 error generated.
Makefile:1619: recipe for target 'stap-probe.o' failed




I think that it is up to the configuration step to take care of evaluating whether the compiler is new enough to accept this construct, and fail otherwise. Details about the error itself: https://stackoverflow.com/questions/7411515/why-does-c-require-a-user-provided-default-constructor-to-default-construct-a
Comment 1 Tom Tromey 2019-12-19 18:40:48 UTC
I sent a patch.
Comment 2 Sourceware Commits 2020-01-07 16:46:17 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4212d5091457541bd7e7eff0591805ef7b7333e3

commit 4212d5091457541bd7e7eff0591805ef7b7333e3
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Dec 19 11:35:22 2019 -0700

    Add constructor to stap_static_probe_ops
    
    PR build/24937 concerns an error given by the clang provided by a
    particular version of macOS.  In particular, it reports
    
        error: default initialization of an object of const type 'const
        stap_static_probe_ops' without a user-provided default constructor
    
    Although (at least according to sources I found online) this was
    resolved as a bug in the standard, it seemed simple enough to work
    around this.
    
    Given that this is a trivial build fix, I think it should go on the
    gdb 9 branch as well.
    
    gdb/ChangeLog
    2020-01-07  Tom Tromey  <tromey@adacore.com>
    
    	PR build/24937:
    	* stap-probe.c (class stap_static_probe_ops): Add constructor.
    
    Change-Id: I18f180c17850f420e9b66afc67f9cb3d8dceb0b3
Comment 3 Sourceware Commits 2020-01-07 16:50:07 UTC
The gdb-9-branch branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3c473fad8f153feee08dce0d79f0b1119a7be2a6

commit 3c473fad8f153feee08dce0d79f0b1119a7be2a6
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Dec 19 11:35:22 2019 -0700

    Add constructor to stap_static_probe_ops
    
    PR build/24937 concerns an error given by the clang provided by a
    particular version of macOS.  In particular, it reports
    
        error: default initialization of an object of const type 'const
        stap_static_probe_ops' without a user-provided default constructor
    
    Although (at least according to sources I found online) this was
    resolved as a bug in the standard, it seemed simple enough to work
    around this.
    
    Given that this is a trivial build fix, I think it should go on the
    gdb 9 branch as well.
    
    2020-01-07  Tom Tromey  <tromey@adacore.com>
    
    	PR build/24937:
    	* stap-probe.c (class stap_static_probe_ops): Add constructor.
    
    Change-Id: I18f180c17850f420e9b66afc67f9cb3d8dceb0b3
Comment 4 Tom Tromey 2020-01-07 16:51:20 UTC
I worked around this by adding the constructor.