RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1061435 - Clang exposes bug with unexpected forward-declaration of type_info
Summary: Clang exposes bug with unexpected forward-declaration of type_info
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc
Version: 6.3
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 6.6
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard:
: 1129899 (view as bug list)
Depends On:
Blocks: 1056252
TreeView+ depends on / blocked
 
Reported: 2014-02-04 20:39 UTC by Bryan Totty
Modified: 2018-12-09 17:28 UTC (History)
6 users (show)

Fixed In Version: gcc-4.4.7-5.el6
Doc Type: Bug Fix
Doc Text:
Prior this release, a program using <typeinfo> and <exception> headers would fail to compile with an "incomplete type" error message when compiled with a Clang compiler. This does not happen with G++ compiler, since it declares std::type_info implicitly. The <exception> header in libstdc++ has been adjusted and now the program compiles correctly even with the clang compiler.
Clone Of:
Environment:
Last Closed: 2014-10-14 05:01:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 56468 0 P3 RESOLVED Clang exposes bug with unexpected forward-declaration of type_info 2020-10-28 14:38:13 UTC
Red Hat Product Errata RHBA-2014:1377 0 normal SHIPPED_LIVE gcc bug fix and enhancement update 2014-10-14 01:06:11 UTC

Description Bryan Totty 2014-02-04 20:39:25 UTC
Copied from: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56468
--------------------------

The following program fails to compile with Clang++ 3.2:

#include <typeinfo>
#include <exception>

const char* get_name( const std::exception_ptr eptr )
{
  return eptr.__cxa_exception_type()->name();
}

int main() {}

The output in the shell is:

$ g++-4.7 -std=c++0x -O3 -Wall -Wextra t.cc -o t
$ clang++-3.2 -std=c++0x -O3 -Wall -Wextra t.cc -o t
t.cc:6:37: error: member access into incomplete type 'const class type_info'
  return eptr.__cxa_exception_type()->name();
                                    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/exception_ptr.h:144:19: note: forward declaration of
      'std::__exception_ptr::type_info'
      const class type_info*
                  ^
1 error generated.
$

The problem is that <typeinfo> includes <exception> before it forward-declares std::type_info. In <exception>, type_info is used in the context of std::__exception_ptr, thus Clang generates an implicit forward-declaration for std::__exception_ptr::type_info and, when used in the above code, consequently fails.

Further discussion has taken place at <http://stackoverflow.com/q/15098174>.

Comment 1 Jakub Jelinek 2014-02-10 14:08:25 UTC
Well, it is not a bug, because g++ predeclares that.
Now, you are mentioning gcc 4.7, so what exactly would you like to be changed in RHEL?  DTS 1.[01] gcc (the only 47 one we ship, or DTS 2, or system gcc (4.4-RH), something else?

Comment 2 Bryan Totty 2014-03-03 22:58:18 UTC
This was meant to be against g++ 4.4.6 on RHEL 6.3. The upstream bug description in this Red Hat bug was copied from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56468 which is what actually defined 4.7 in the test.

Do you know if this applies to our supported g++ 4.4 version for RHEL 6? This may have only been an issue in g++ 4.7, but I am not certain.

Comment 3 Jeff Law 2014-03-13 16:35:54 UTC
Sorry, but our policy is not to fix missed-error bugs in the RHEL base compiler.  Such changes run the very real risk of code which had previously compiled with the RHEL base compiler no longer compiling.

Comment 8 Jeff Law 2014-03-13 19:15:45 UTC
Jakub & Jonathan set me stright.  I clearly misunderstood the issue here.

GCC has an implicit declaration which results in GCC accepting this code without an error.  Clang doesn't have the implicit declaration and thus complains.  The request is to fix exception_ptr.h to explicitly declare type_info which should be safe.

This BZ is _not_ a request to have GCC issue an error here.

Comment 17 errata-xmlrpc 2014-10-14 05:01:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1377.html

Comment 18 Dave Johansen 2014-10-31 02:59:37 UTC
*** Bug 1129899 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.