public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61457] New: Inaccurately refusing non-ODR usage of type with no linkage
@ 2014-06-09 20:00 filip.roseen at gmail dot com
  2014-06-11 10:05 ` [Bug c++/61457] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: filip.roseen at gmail dot com @ 2014-06-09 20:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61457

            Bug ID: 61457
           Summary: Inaccurately refusing non-ODR usage of type with no
                    linkage
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.roseen at gmail dot com

Created attachment 32912
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32912&action=edit
testcase.cpp

enum { X };

struct A { static constexpr auto val = X; };

int main () {
  int x = A::val;
}


-------------------------

`gcc` is inaccurately rejecting `testcase.cpp` with the following diagnostic:


 > testcase.cpp:3:34: error: ‘constexpr const<anonymous enum> A::val’, declared
 > using anonymous type, is used but never defined [-fpermissive]
 > struct A { static constexpr auto val = X; };
 >                                  ^

-------------------------

A detailed answer was provided by me at
http://stackoverflow.com/a/24019645/1090079

It is stated that an unnamed enum has no linkage in [basic.link]p8, but we must
also remember the following which is also stated in [basic.link]p8:

  >  A type without linkage shall not be used as the type of a variable
  >  or function with external linkage unless:
  >    - the entity has C language linkage (7.5), or
  >    - the entity is declared within an unnamed namespace (7.3.1), or
  >    - the entity is not odr-used (3.2) or is defined in the same translation
         unit

----------------------------

`clang` correctly accepts the snippet.
>From gcc-bugs-return-453569-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jun 09 20:03:56 2014
Return-Path: <gcc-bugs-return-453569-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21766 invoked by alias); 9 Jun 2014 20:03:55 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 21695 invoked by uid 48); 9 Jun 2014 20:03:51 -0000
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51373] [C++0x] ICE for static pointer to member initialized in-class
Date: Mon, 09 Jun 2014 20:03:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jason at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: resolution
Message-ID: <bug-51373-4-b8nmfWYjYM@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-51373-4@http.gcc.gnu.org/bugzilla/>
References: <bug-51373-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-06/txt/msg00651.txt.bz2
Content-length: 441

https://gcc.gnu.org/bugzilla/show_bug.cgi?idQ373

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed by r196852.

*** This bug has been marked as a duplicate of bug 54532 ***


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-03 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 20:00 [Bug c++/61457] New: Inaccurately refusing non-ODR usage of type with no linkage filip.roseen at gmail dot com
2014-06-11 10:05 ` [Bug c++/61457] " paolo.carlini at oracle dot com
2014-12-14 14:55 ` ville.voutilainen at gmail dot com
2021-12-03  5:50 ` [Bug c++/61457] [C++11/14 only] " pinskia at gcc dot gnu.org
2021-12-03 12:26 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).