public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous
@ 2013-04-23 10:17 frederic.hecht at upmc dot fr
2013-04-23 11:12 ` [Bug c++/57043] " redi at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: frederic.hecht at upmc dot fr @ 2013-04-23 10:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Bug #: 57043
Summary: converting overloaded complex function pow in C++11 is
ambiguous
Classification: Unclassified
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: frederic.hecht@upmc.fr
problem template the code is trivial 2 lines:
do not compile in version 4.9, 4.8.1 4.9 with
/usr/local/bin/g++ -v -save-temps -std=c++11 -c bugcc.cpp
the code:
#include <complex>
std::complex<double> (* powcc )( const std::complex<double> &, const
std::complex<double> &) =std::pow;
the output is
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.3' '-v' '-save-temps'
'-std=c++11' '-c' '-shared-libgcc' '-mtune=core2'
/usr/local/libexec/gcc/x86_64-apple-darwin12.3.0/4.8.1/cc1plus -fpreprocessed
bugcc.ii -fPIC -quiet -dumpbase bugcc.cpp -mmacosx-version-min=10.8.3
-mtune=core2 -auxbase bugcc -std=c++11 -version -o bugcc.s
GNU C++ (GCC) version 4.8.1 20130404 (prerelease) (x86_64-apple-darwin12.3.0)
compiled by GNU C version 4.8.1 20130404 (prerelease), GMP version 4.3.1,
MPFR version 2.4.1, MPC version 0.8.1
heuristiques GGC: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.8.1 20130404 (prerelease) (x86_64-apple-darwin12.3.0)
compiled by GNU C version 4.8.1 20130404 (prerelease), GMP version 4.3.1,
MPFR version 2.4.1, MPC version 0.8.1
heuristiques GGC: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 848d439cd6121247863767d4caeedace
bugcc.cpp:2:100: erreur: converting overloaded function ‘pow’ to type ‘struct
std::complex<double> (*)(const struct std::complex<double>&, const struct
std::complex<double>&)’ is ambiguous
std::complex<double> (* powcc )( const std::complex<double> &, const
std::complex<double> &) =std::pow;
^
In file included from bugcc.cpp:1:0:
/usr/local/include/c++/4.8.1/complex:1023:5: note: candidats sont:
std::complex<_Tp> std::pow(const std::complex<_Tp>&, const std::complex<_Tp>&)
[with _Tp = double]
pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
^
In file included from bugcc.cpp:1:0:
/usr/local/include/c++/4.8.1/complex:1871:5: note:
std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const
std::complex<_Tp>&, const std::complex<_Up>&) [with _Tp = double; _Up = double;
typename __gnu_cxx::__promote_2<_Tp, _Up>::__type = double]
pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
^
>From gcc-bugs-return-420789-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 23 10:29:50 2013
Return-Path: <gcc-bugs-return-420789-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20825 invoked by alias); 23 Apr 2013 10:29:50 -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 20799 invoked by uid 48); 23 Apr 2013 10:29:48 -0000
From: "pberuto at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57044] New: The following code won't compile with -std=c++0x
Date: Tue, 23 Apr 2013 10:29:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: pberuto at yahoo dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57044-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01934.txt.bz2
Content-length: 1073
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW044
Bug #: 57044
Summary: The following code won't compile with -std=c++0x
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pberuto@yahoo.com
The following code causes a GCC internal error Segmentation fault:
class myclass
{
public:
template<typename T_>
inline explicit myclass(T_ *s)
{
char buf[mylib::someclass::some_const]; // this line causes the fault
// ... do something useful with buf
}
...
};
// somewhere else:
nemaspace mylib
{
class someclass
{
public:
static const uint32_t some_const;
}
}
// other info:
all GCC versions from 4.5.3 and below compile that code fine. Not tested with
other gcc versions before 4.7.2.
compile flags are CXXFLAGS="-g -O0 -pipe -std=c++0x"
Thank you.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
@ 2013-04-23 11:12 ` redi at gcc dot gnu.org
2013-05-20 23:48 ` [Bug c++/57043] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2013-04-23 11:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-04-23
Component|libstdc++ |c++
Known to work| |4.6.3
Ever Confirmed|0 |1
Known to fail| |4.7.3, 4.8.0, 4.9.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-04-23 11:12:21 UTC ---
I think this is a front-end issue, the following compiles OK with G++ 4.6,
Clang 3.3 and ICC 13, but not G++ 4.7+ (in c++98 or c++11 mode)
template<typename D> struct complex { };
template<typename Tp>
inline complex<Tp>
pow(const complex<Tp>& x, const complex<Tp>& y)
{ return x; }
template<typename T, typename U>
struct promote_2
{
typedef T type;
};
template<typename Tp, typename Up>
inline complex<typename promote_2<Tp, Up>::type>
pow(const complex<Tp>& x, const complex<Up>& y)
{ return x; }
complex<double> (*powcc)(const complex<double>&, const complex<double>&) = pow;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
2013-04-23 11:12 ` [Bug c++/57043] " redi at gcc dot gnu.org
@ 2013-05-20 23:48 ` paolo.carlini at oracle dot com
2013-07-09 7:43 ` jason at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-20 23:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|converting overloaded |[4.7/4.8/4.9 Regression]
|complex function pow in |converting overloaded
|C++11 is ambiguous |complex function pow in
| |C++11 is ambiguous
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Marking (tentatively) as regression, then.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
2013-04-23 11:12 ` [Bug c++/57043] " redi at gcc dot gnu.org
2013-05-20 23:48 ` [Bug c++/57043] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
@ 2013-07-09 7:43 ` jason at gcc dot gnu.org
2013-09-06 11:27 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2013-07-09 7:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
OK, this is puzzling.
The issue is that GCC can't tell that the first pow is more specialized than
the second; deduction happens fine, but when we substitute in Tp(1) for Tp(2)
and Up we still have complex<typename promote_2<Tp(1), Tp(1)>::type> for the
return type, which looks different from complex<Tp(1)>, so deduction fails and
we decide it isn't more specialized.
I can't figure out what interpretation of the standard clang/EDG are using to
make this work. Are they actually instantiating promote_2? That doesn't seem
to be it, as they also accept the following, which seems clearly unordered to
me:
template<typename D> struct complex { };
template <class T> struct promote_1 { typedef T type; };
template<typename T, typename U> struct promote_2 { typedef T type; };
template<typename Tp>
complex<typename promote_1<Tp>::type>
pow(const complex<Tp>& x, const complex<Tp>& y);
template<typename Tp, typename Up>
complex<typename promote_2<Tp, Up>::type>
pow(const complex<Tp>& x, const complex<Up>& y);
complex<double> (*powcc)(const complex<double>&, const complex<double>&) = pow;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (2 preceding siblings ...)
2013-07-09 7:43 ` jason at gcc dot gnu.org
@ 2013-09-06 11:27 ` rguenth at gcc dot gnu.org
2013-10-25 13:01 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-09-06 11:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (3 preceding siblings ...)
2013-09-06 11:27 ` rguenth at gcc dot gnu.org
@ 2013-10-25 13:01 ` rguenth at gcc dot gnu.org
2014-01-31 3:51 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-25 13:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
So this is rightfully rejected?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (4 preceding siblings ...)
2013-10-25 13:01 ` rguenth at gcc dot gnu.org
@ 2014-01-31 3:51 ` jason at gcc dot gnu.org
2014-01-31 15:20 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 3:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Discussion in the C++ committee has convinced me that G++ is wrong here.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (5 preceding siblings ...)
2014-01-31 3:51 ` jason at gcc dot gnu.org
@ 2014-01-31 15:20 ` jason at gcc dot gnu.org
2014-01-31 15:21 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 15:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jan 31 15:20:05 2014
New Revision: 207345
URL: http://gcc.gnu.org/viewcvs?rev=207345&root=gcc&view=rev
Log:
PR c++/57043
* pt.c (fn_type_unification): Don't do DEDUCE_EXACT check
during partial ordering.
Added:
trunk/gcc/testsuite/g++.dg/template/partial15.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (6 preceding siblings ...)
2014-01-31 15:20 ` jason at gcc dot gnu.org
@ 2014-01-31 15:21 ` jason at gcc dot gnu.org
2014-01-31 15:56 ` jason at gcc dot gnu.org
2014-01-31 16:09 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jan 31 15:21:13 2014
New Revision: 207347
URL: http://gcc.gnu.org/viewcvs?rev=207347&root=gcc&view=rev
Log:
PR c++/57043
* pt.c (fn_type_unification): Don't do DEDUCE_EXACT check
during partial ordering.
Added:
branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/partial15.C
Modified:
branches/gcc-4_8-branch/gcc/cp/ChangeLog
branches/gcc-4_8-branch/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (7 preceding siblings ...)
2014-01-31 15:21 ` jason at gcc dot gnu.org
@ 2014-01-31 15:56 ` jason at gcc dot gnu.org
2014-01-31 16:09 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 15:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jan 31 15:55:46 2014
New Revision: 207355
URL: http://gcc.gnu.org/viewcvs?rev=207355&root=gcc&view=rev
Log:
PR c++/57043
* pt.c (fn_type_unification): Don't do DEDUCE_EXACT check
during partial ordering.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/partial15.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/57043] [4.7/4.8/4.9 Regression] converting overloaded complex function pow in C++11 is ambiguous
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
` (8 preceding siblings ...)
2014-01-31 15:56 ` jason at gcc dot gnu.org
@ 2014-01-31 16:09 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 16:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57043
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-01-31 16:09 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23 10:17 [Bug libstdc++/57043] New: converting overloaded complex function pow in C++11 is ambiguous frederic.hecht at upmc dot fr
2013-04-23 11:12 ` [Bug c++/57043] " redi at gcc dot gnu.org
2013-05-20 23:48 ` [Bug c++/57043] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-07-09 7:43 ` jason at gcc dot gnu.org
2013-09-06 11:27 ` rguenth at gcc dot gnu.org
2013-10-25 13:01 ` rguenth at gcc dot gnu.org
2014-01-31 3:51 ` jason at gcc dot gnu.org
2014-01-31 15:20 ` jason at gcc dot gnu.org
2014-01-31 15:21 ` jason at gcc dot gnu.org
2014-01-31 15:56 ` jason at gcc dot gnu.org
2014-01-31 16:09 ` 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).