public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13517] New: confusing error message for reference on a constant
@ 2003-12-30 12:49 debian-gcc at lists dot debian dot org
  2003-12-30 17:33 ` [Bug c++/13517] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2003-12-30 12:49 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/216209]

seen with 3.3.2.

The following program consists of two classes, both with a
parametrized method. Depending on the parameter type g++ the
compilation fails or not...

-- snip --
class E1 {
public:
  template <class T>
  void print(T bla) { };
};

class E2 {
public:
  // same as above but with a reference
  template <class T>
  void print(T& bla) { };
};

void foo1() {
  E1 e;

  // works
  e.print("hurz");

  // works too
  e.print(23);
};

void foo2() {
  E2 e;

  // works
  e.print("hurz");

  // fails!
  e.print(23);
};

int main () {  
};
-- snip --

riff /tmp> g++ -Wall temptest1.cc
temptest1.cc: In function `void foo2()':
temptest1.cc:33: error: no matching function for call to
`E2::print(int)'
temptest1.cc:13: error: candidates are: void E2::print(T&) [with T =
int]
Exitcode 1
riff /tmp> g++ --version
g++ (GCC) 3.3.2 20031005 (Debian prerelease)
[...]

This behavoir is at least inconsistent and I believe it to be
buggy. However, the Intel Compiler fails on the same line, so maybe
it's a special case in the C++-specs?!

Cheers
   Thimo

Followup:

I asked a second person when I filed the original bug report but now a
third person saw the problem. Yes, the call tries to create a
reference on a constant and thus cannot compile. But in that case, the
error-message is very misleading.

I've already changed the bug title and changed the severity to
wishlist.

Cheers
   Thimo

-- 
           Summary: confusing error message for reference on a constant
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-01-01  2:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-30 12:49 [Bug c++/13517] New: confusing error message for reference on a constant debian-gcc at lists dot debian dot org
2003-12-30 17:33 ` [Bug c++/13517] " pinskia at gcc dot gnu dot org
2003-12-30 18:23 ` falk at debian dot org
2003-12-30 19:45 ` pinskia at gcc dot gnu dot org
2004-01-01  2:47 ` pinskia at gcc dot gnu 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).