public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48449] New: [C++0x][SFINAE] Hard errors during value-initialization expressions
@ 2011-04-05  6:33 daniel.kruegler at googlemail dot com
  2011-04-07 21:47 ` [Bug c++/48449] " jason at gcc dot gnu.org
  2011-04-08 15:12 ` jason at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-04-05  6:33 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x][SFINAE] Hard errors during
                    value-initialization expressions
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com


The following code involving reference types, function types, and abstract
class type should be well-formed, but are not:

template<class T, class = decltype(T())>
char f(int);

template<class>
char (&f(...))[2];

struct A { virtual ~A() = 0; };

static_assert(sizeof(f<int&>(0)) != 1, "Error"); // a
static_assert(sizeof(f<void()>(0)) != 1, "Error"); // b
static_assert(sizeof(f<A>(0)) != 1, "Error"); // c

The corresponding error messages are:

a) "error: invalid value-initialization of reference type"
b) "error: conversion from 'int' to non-scalar type 'void()' requested"
c) "error: cannot allocate an object of abstract type 'A' because the
following virtual functions are pure within 'A': virtual A::~A()"


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

* [Bug c++/48449] [C++0x][SFINAE] Hard errors during value-initialization expressions
  2011-04-05  6:33 [Bug c++/48449] New: [C++0x][SFINAE] Hard errors during value-initialization expressions daniel.kruegler at googlemail dot com
@ 2011-04-07 21:47 ` jason at gcc dot gnu.org
  2011-04-08 15:12 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-07 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-07 21:47:14 UTC ---
Author: jason
Date: Thu Apr  7 21:47:10 2011
New Revision: 172141

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172141
Log:
    PR c++/48449
    * typeck2.c (build_functional_cast): Check complain consistently.
    Use build_value_init and abstract_virtuals_error_sfinae.
    (abstract_virtuals_error_sfinae): Split out.
    * cp-tree.h: Declare it.
    * init.c (build_new_1): Use it.
    (build_value_init_noctor): Handle FUNCTION_TYPE.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/sfinae8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/init.c
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/48449] [C++0x][SFINAE] Hard errors during value-initialization expressions
  2011-04-05  6:33 [Bug c++/48449] New: [C++0x][SFINAE] Hard errors during value-initialization expressions daniel.kruegler at googlemail dot com
  2011-04-07 21:47 ` [Bug c++/48449] " jason at gcc dot gnu.org
@ 2011-04-08 15:12 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-08 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-08 15:12:36 UTC ---
Fixed.


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

end of thread, other threads:[~2011-04-08 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-05  6:33 [Bug c++/48449] New: [C++0x][SFINAE] Hard errors during value-initialization expressions daniel.kruegler at googlemail dot com
2011-04-07 21:47 ` [Bug c++/48449] " jason at gcc dot gnu.org
2011-04-08 15:12 ` 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).