| Summary: |
g++ sometimes treats a reference to a non-overloaded template function as overloaded |
| Product: |
[openSUSE] openSUSE 11.4
|
Reporter: |
Christopher Yeleighton <giecrilj> |
| Component: |
Development | Assignee: |
Richard Biener <rguenther> |
| Status: |
RESOLVED
UPSTREAM
|
QA Contact: |
E-mail List <qa-bugs> |
| Severity: |
Major
|
|
|
| Priority: |
P5 - None
|
CC: |
ihno, pth
|
| Version: |
Final | |
|
| Target Milestone: |
--- | |
|
| Hardware: |
Other | |
|
| OS: |
openSUSE 11.4 | |
|
| Whiteboard: |
|
|
Found By:
|
---
|
Services Priority:
|
|
|
Business Priority:
|
|
Blocker:
|
---
|
|
Marketing QA Status:
|
---
|
IT Deployment:
|
---
|
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2 The function foo < void > below is unambiguously defined; however, GNU C++ requires an information about its type in order to evaluate a reference to it. Reproducible: Always Steps to Reproduce: 1. { cat <<'/* EOF */' >overloaded.cpp && g++ overloaded.cpp; } template < class T > void foo () { } void bar () {} void (*good ()) () { return bar; return foo < void >; } int bad () { return !bar; return !foo < void >; } /* EOF */ Actual Results: 1. overloaded.cpp: In function ‘int bad()’: overloaded.cpp:9:9: error: cannot resolve overloaded function ‘foo’ based on conversion to type ‘bool’ overloaded.cpp:9:9: error: in argument to unary ! Expected Results: 1. link error: undefined reference to symbol 'main' Thank you for testing your code with Comeau C/C++! Tell others about http://www.comeaucomputing.com/tryitout ! Your Comeau C/C++ test results are as follows: Comeau C/C++ 4.3.10.1 (Oct 6 2008 11:28:09) for ONLINE_EVALUATION_BETA2 Copyright 1988-2008 Comeau Computing. All rights reserved. MODE:strict errors C++ C++0x_extensions "ComeauTest.c", line 5: warning: statement is unreachable return foo < void >; ^ "ComeauTest.c", line 8: warning: controlling expression is constant return !bar; ^ "ComeauTest.c", line 9: warning: statement is unreachable return !foo < void >; ^ "ComeauTest.c", line 9: warning: controlling expression is constant return !foo < void >; ^ In strict mode, with -tused, Compile succeeded (but remember, the Comeau online compiler does not link).