public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21066] New: Regression: template argument deduction finds false ambiguity
@ 2005-04-17 3:45 mckelvey at maskull dot com
2005-04-17 3:47 ` [Bug c++/21066] " mckelvey at maskull dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mckelvey at maskull dot com @ 2005-04-17 3:45 UTC (permalink / raw)
To: gcc-bugs
The attached code has compiled fine for several years on g++, and compiles on
the Compaq CXX compiler. It recently gives the following:
/usr/local/bin/g++ -c -g -fno-elide-constructors -pedantic-errors -Werror
-ansi -fno-common -fstrict-aliasing -Wall -Wold-style-cast -Wsign-promo
-Wpointer-arith -Wconversion -Wundef -Wwrite-strings -Winvalid-pch
-Woverloaded-virtual -Wcast-qual -Wextra -Wredundant-decls -Wshadow -MMD
-fimplicit-templates -o stest.o stest.cc
stest.cc: In function 'int main(int, char**)':
stest.cc:69: error: call of overloaded 'muv(const functor_t&, int
(functor_t::*)()const)' is ambiguous
stest.cc:35: note: candidates are: int muv(T&, int (T::*)()) [with T = const
functor_t]
stest.cc:55: note: int muv(const T&, int (T::*)()const) [with T
= functor_t]
gmake: *** [stest.o] Error 1
It looks like a type of const functor_t causes int (T::*)() to be interpreted as
int (T::*)()const.
Even if this represents a new check, and is valid, why doesn't the compiler also
complain about an ambiguity with the third form, int muv(T&, int (T::*)()const?
alpha1:PD>g++ -v
Using built-in specs.
Target: alphaev56-unknown-linux-gnu
Configured with: ../gcc/configure --verbose --enable-languages=c++ --disable-nls
Thread model: posix
gcc version 4.1.0 20050409 (experimental)
alias CONFIGURECVS='../gcc/configure --verbose --enable-languages=c++
--disable-nls >clog 2>&1 &'
alias BUILD='nice gmake CFLAGS='\'''\'' BOOT_CFLAGS='\'''\''
LIBCFLAGS='\''-g'\'' LIBCXXFLAGS='\''-g'\'' bootstrap >log 2>&1 &'
--
Summary: Regression: template argument deduction finds false
ambiguity
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mckelvey at maskull dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: alphaev56-unknown-linux-gnu
GCC host triplet: alphaev56-unknown-linux-gnu
GCC target triplet: alphaev56-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21066
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/21066] Regression: template argument deduction finds false ambiguity
2005-04-17 3:45 [Bug c++/21066] New: Regression: template argument deduction finds false ambiguity mckelvey at maskull dot com
@ 2005-04-17 3:47 ` mckelvey at maskull dot com
2005-04-17 15:09 ` [Bug c++/21066] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-31 18:01 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: mckelvey at maskull dot com @ 2005-04-17 3:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mckelvey at maskull dot com 2005-04-17 03:47 -------
Created an attachment (id=8664)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8664&action=view)
Example source code
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21066
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/21066] [4.1 Regression] template argument deduction finds false ambiguity
2005-04-17 3:45 [Bug c++/21066] New: Regression: template argument deduction finds false ambiguity mckelvey at maskull dot com
2005-04-17 3:47 ` [Bug c++/21066] " mckelvey at maskull dot com
@ 2005-04-17 15:09 ` pinskia at gcc dot gnu dot org
2005-05-31 18:01 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-17 15:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-17 15:08 -------
Confirmed, reduced testcacse:
struct ff { ff(); int cmem(void) const; };
template <typename T>
int muv(T&, int (T::*)(void));
template <typename T>
int muv(T&, int (T::*)(void) const);
template <typename T>
int muv(const T&, int (T::*)(void) const);
int main()
{
ff f;
const ff cf;
muv(cf, &ff::cmem);
muv(f, &ff::cmem);
}
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2005-04-17 15:08:58
date| |
Summary|Regression: template |[4.1 Regression] template
|argument deduction finds |argument deduction finds
|false ambiguity |false ambiguity
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21066
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/21066] [4.1 Regression] template argument deduction finds false ambiguity
2005-04-17 3:45 [Bug c++/21066] New: Regression: template argument deduction finds false ambiguity mckelvey at maskull dot com
2005-04-17 3:47 ` [Bug c++/21066] " mckelvey at maskull dot com
2005-04-17 15:09 ` [Bug c++/21066] [4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-05-31 18:01 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2005-05-31 18:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-05-31 17:56 -------
PR 21799 treats the same problem, but looks a little cleaner and has some
additional comments.
W.
*** This bug has been marked as a duplicate of 21799 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21066
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-31 17:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-17 3:45 [Bug c++/21066] New: Regression: template argument deduction finds false ambiguity mckelvey at maskull dot com
2005-04-17 3:47 ` [Bug c++/21066] " mckelvey at maskull dot com
2005-04-17 15:09 ` [Bug c++/21066] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-31 18:01 ` bangerth at dealii dot 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).