public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56041] New: Constexpr conversion function definition not found in template argument context
@ 2013-01-18 22:54 webrown.cpp at gmail dot com
  2013-01-19 14:29 ` [Bug c++/56041] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: webrown.cpp at gmail dot com @ 2013-01-18 22:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56041

             Bug #: 56041
           Summary: Constexpr conversion function definition not found in
                    template argument context
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: webrown.cpp@gmail.com


Created attachment 29215
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29215
C++11 metaprogramming experiment

Enclosed code fails to compile, but should.

Tested with:
  g++-mp-4.7 (MacPorts gcc47 4.7.2_2) 4.7.2
  g++-mp-4.8 (MacPorts gcc48 4.8-20130113_0) 4.8.0 20130113 (experimental)

Compiled via:
  g++-mp-4.7 -O3 -std=c++0x main.cc
  g++-mp-4.8 -O3 -std=c++0x main.cc

Use of expression true_type{} as template argument corresponding to bool
template parameter produces diagnostic:
  'constexpr integral_constant<T, v>::operator T() const [with T = bool; T v =
true]' used before its definition

[The syntax variant true_type() [note parentheses instead of braces as shown
above] is correctly diagnosed, applying 14.3/2.  This variant, as well as a
C++03-style variant, are present but commented out in the attachment; I left
them for possible additional experimentation.]

Using braces should force interpretation as an expression, not a type.  That
expression should result in a default-constructed temporary object of the named
type; that type, defined earlier in the source, has a conversion operator
defined inline.  However, the compiler claims that the operator's definition is
not yet defined at the point of (implicit) use.


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

* [Bug c++/56041] Constexpr conversion function definition not found in template argument context
  2013-01-18 22:54 [Bug c++/56041] New: Constexpr conversion function definition not found in template argument context webrown.cpp at gmail dot com
@ 2013-01-19 14:29 ` redi at gcc dot gnu.org
  2014-11-18  1:26 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-19 14:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56041

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-19
     Ever Confirmed|0                           |1


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

* [Bug c++/56041] Constexpr conversion function definition not found in template argument context
  2013-01-18 22:54 [Bug c++/56041] New: Constexpr conversion function definition not found in template argument context webrown.cpp at gmail dot com
  2013-01-19 14:29 ` [Bug c++/56041] " redi at gcc dot gnu.org
@ 2014-11-18  1:26 ` jason at gcc dot gnu.org
  2014-11-20  3:26 ` jason at gcc dot gnu.org
  2014-11-20  3:37 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2014-11-18  1:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/56041] Constexpr conversion function definition not found in template argument context
  2013-01-18 22:54 [Bug c++/56041] New: Constexpr conversion function definition not found in template argument context webrown.cpp at gmail dot com
  2013-01-19 14:29 ` [Bug c++/56041] " redi at gcc dot gnu.org
  2014-11-18  1:26 ` jason at gcc dot gnu.org
@ 2014-11-20  3:26 ` jason at gcc dot gnu.org
  2014-11-20  3:37 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2014-11-20  3:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Nov 20 03:25:26 2014
New Revision: 217823

URL: https://gcc.gnu.org/viewcvs?rev=217823&root=gcc&view=rev
Log:
    PR c++/56041
    * cp-tree.h (struct processing_template_decl_sentinel): New.
    * pt.c (instantiate_non_dependent_expr_internal): Split out from...
    (instantiate_non_dependent_expr_sfinae): Here.
    (convert_nontype_argument): Use them.
    * constexpr.c (fold_non_dependent_expr): Use them.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-conv1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/pt.c


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

* [Bug c++/56041] Constexpr conversion function definition not found in template argument context
  2013-01-18 22:54 [Bug c++/56041] New: Constexpr conversion function definition not found in template argument context webrown.cpp at gmail dot com
                   ` (2 preceding siblings ...)
  2014-11-20  3:26 ` jason at gcc dot gnu.org
@ 2014-11-20  3:37 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2014-11-20  3:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 5.


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

end of thread, other threads:[~2014-11-20  3:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 22:54 [Bug c++/56041] New: Constexpr conversion function definition not found in template argument context webrown.cpp at gmail dot com
2013-01-19 14:29 ` [Bug c++/56041] " redi at gcc dot gnu.org
2014-11-18  1:26 ` jason at gcc dot gnu.org
2014-11-20  3:26 ` jason at gcc dot gnu.org
2014-11-20  3:37 ` jason 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).