From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24916 invoked by alias); 8 Jun 2004 20:41:02 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24838 invoked by uid 48); 8 Jun 2004 20:41:01 -0000 Date: Tue, 08 Jun 2004 20:41:00 -0000 From: "bangerth at dealii dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20040608204054.15882.bangerth@dealii.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/15882] New: Check for return type of overloaded operator new too early X-Bugzilla-Reason: CC X-SW-Source: 2004-06/txt/msg00990.txt.bz2 List-Id: I don't know what to say about this, but I'd like to solicit second opinions -- this fails: ----------------------- #include template struct SFINAE; template struct SFINAE { typedef T type; }; SFINAE::type operator new (size_t, int); template typename SFINAE::type operator new (size_t, T); ------------------------ g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c y.cc y.cc:14: error: `operator new' must return type `void*' I believe that the check for the return type is set too early, while parsing the declaration of the template, not during instantiation. As is shown in the first overload of the operator, gcc is quite happy with a somewhat convoluted way to specify a return type of 'void*'. In the second overload, this may still be possible, if just the type 'T' has an appropriately defined static member condition, or something else that can be converted to a bool evaluating to 'true'. However, the fact that we already get the error message before we even try to instantiate something seems wrong. W. -- Summary: Check for return type of overloaded operator new too early Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at dealii dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15882