public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45492]  New: G++ permits function-to-data pointer conversions with __extension__ in functions, but not function templates
@ 2010-09-02  0:29 jimb at red-bean dot com
  2010-09-02  0:30 ` [Bug c++/45492] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 3+ messages in thread
From: jimb at red-bean dot com @ 2010-09-02  0:29 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]

With trunk G++:

$ ~/gcc/bin/g++ --version
g++ (GCC) 4.6.0 20100901 (experimental)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat fdc.cc
extern void cf();

// no warning
void *f() { return __extension__ (void *) cf; }

// warning:
// ISO C++ forbids casting between pointer-to-function and pointer-to-object
template<bool flag>
void *ft() { return __extension__ (void *) cf; }

template void *ft<true>();
$ LD_LIBRARY_PATH=$HOME/gcc/lib ~/gcc/bin/g++ -Wall -pedantic -c fdc.cc
fdc.cc: In function ‘void* ft() [with bool flag = true]’:
fdc.cc:11:25:   instantiated from here
fdc.cc:9:44: warning: ISO C++ forbids casting between pointer-to-function and
pointer-to-object [enabled by default]

I would expect G++ to either complain about both casts, or neither; whether the
code appears in a function template shouldn't matter.


-- 
           Summary: G++ permits function-to-data pointer conversions with
                    __extension__ in functions, but not function templates
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jimb at red-bean dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/45492] G++ permits function-to-data pointer conversions with __extension__ in functions, but not function templates
  2010-09-02  0:29 [Bug c++/45492] New: G++ permits function-to-data pointer conversions with __extension__ in functions, but not function templates jimb at red-bean dot com
@ 2010-09-02  0:30 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-02  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-09-02 00:30 -------
Related to PR 21385.


-- 


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


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

* [Bug c++/45492] G++ permits function-to-data pointer conversions with __extension__ in functions, but not function templates
       [not found] <bug-45492-4@http.gcc.gnu.org/bugzilla/>
@ 2012-05-29 11:53 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-29 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org |
         Resolution|                            |DUPLICATE

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-29 11:52:52 UTC ---
It's the same issue.

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


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

end of thread, other threads:[~2012-05-29 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02  0:29 [Bug c++/45492] New: G++ permits function-to-data pointer conversions with __extension__ in functions, but not function templates jimb at red-bean dot com
2010-09-02  0:30 ` [Bug c++/45492] " pinskia at gcc dot gnu dot org
     [not found] <bug-45492-4@http.gcc.gnu.org/bugzilla/>
2012-05-29 11:53 ` paolo.carlini at oracle dot com

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).