[Bug c++/21386] Inconsistent diagnostics for taking address of rvalue

2005-05-06 Thread benh at bwsint dot com

--- Additional Comments From benh at bwsint dot com  2005-05-06 16:10 
---
(In reply to comment #2)
> Note ICC causes the same thing in terms of error vs warning.

That'll be because ICC emulates gcc behaviour...


-- 


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


[Bug c++/21386] Inconsistent diagnostics for taking address of rvalue

2005-05-06 Thread benh at bwsint dot com

--- Additional Comments From benh at bwsint dot com  2005-05-06 16:04 
---
(In reply to comment #1)
> (In reply to comment #0)
> > The first error message is also odd; "non-lvalue" is C terminology that is
> > rarely used in relation to C++.
> 
> That is wrong because the standard actually uses lvalue and rvalue all the 
> time.

Right, and it uses "rvalue" rather than "non-lvalue". So far as I can see, all
rvalues of user-defined type are temporaries, so there would be no loss of
precision in changing "temporary" to "rvalue" as well.


-- 


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


[Bug c++/21386] New: Inconsistent diagnostics for taking address of rvalue

2005-05-04 Thread benh at bwsint dot com
g++ reports an error where a program attempts to take the address of an rvalue
of built-in type, but merely warns where it takes the address of an rvalue of
user-defined type:

$ cat test.cc
int i() { return 0; }
class A {};
A a() { return A(); }
int main()
{
int * pi = &i();
A * pa = &a();
}
$ g++-3.4 test.cc
test.cc: In function `int main()':
test.cc:6: error: non-lvalue in unary `&'
test.cc:7: warning: taking address of temporary

The first error message is also odd; "non-lvalue" is C terminology that is
rarely used in relation to C++.

I would expect an attempt to take the address of an rvalue of any type to result
in an error; it's banned by the standard and I can't think of any useful
semantics for it if it is allowed.

-- 
   Summary: Inconsistent diagnostics for taking address of rvalue
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: minor
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: benh at bwsint dot com
CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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


[Bug c++/19047] Template template argument matching can violate SFINAE

2004-12-16 Thread benh at bwsint dot com


-- 
   What|Removed |Added

  GCC build triplet||i486-linux
   GCC host triplet||i486-linux
 GCC target triplet||i486-linux
   Keywords||rejects-valid
  Known to fail||3.0.4 3.2.3 3.3.4 3.4.3
  Known to work||2.95.4


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


[Bug c++/19047] New: Template template argument matching can violate SFINAE

2004-12-16 Thread benh at bwsint dot com
The following program fails to compile:

#include 

template class CT, int TA>
void operator<<(CT, int);

int main()
{
   std::cout << "Hello, world\n";
}

The error messages given are:
test.cpp: In function `int main()':
test.cpp:8: error: template argument 2 is invalid

-- 
   Summary: Template template argument matching can violate SFINAE
   Product: gcc
   Version: 3.4.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: benh at bwsint dot com
CC: gcc-bugs at gcc dot gnu dot org


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