[Bug c++/51630] New: failure to detect missing

2011-12-19 Thread ramey at rrsd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51630

 Bug #: 51630
   Summary: failure to detect missing
Classification: Unclassified
   Product: gcc
   Version: 4.5.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ra...@rrsd.com


Created attachment 26149
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26149
program compiles with error when an error should be detected

the following code:

struct name {};

bool test1(){
name x, y;
return x < y;
}

name test2(){
name x, y;
return (x < y) ? y : x;
}

emits two error message as it should due to lack of < operator for name.

The following code:

template
const T & max(const T & x, const T & y){
return (x < y) ? y : x;
}

struct name {};

void test3(){
name x, y, z;
z = max(x, y); // error name doesn't have < operator
}

emits no error message.

This looks like a bug to me.  For what it's worth, this second example fails to
compile with MSVC 9.0 pointing to an error for lack of operator < as one would
expect.

Robert Ramey


[Bug c++/51630] failure to detect missing

2011-12-19 Thread ramey at rrsd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51630

--- Comment #1 from Robert Ramey  2011-12-20 07:35:13 
UTC ---
note I am compiling with the following command line under cygwin:

g++-4 -fsyntax-only -Wall -pedantic -Ic:/boostrelease
"c:\Projects\dbms\test.cpp"


[Bug c++/51630] failure to detect missing

2011-12-20 Thread ramey at rrsd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51630

Robert Ramey  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #5 from Robert Ramey  2011-12-20 21:04:38 
UTC ---
thank you for a prompt and spot on answer.  I looked for some more information
on the -fsyntax-only option but didn't find it. These days with lots of
template libraries, skipping the instantiation misses a lot of syntax errors. 
Perhaps another option is in order?

Thank you again.

Robert Ramey


[Bug c++/51630] failure to detect missing

2011-12-20 Thread ramey at rrsd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51630

Robert Ramey  changed:

   What|Removed |Added

 Resolution|INVALID |WONTFIX

--- Comment #7 from Robert Ramey  2011-12-21 05:39:49 
UTC ---
what I expected was that -fsyntax-only would run the normal process but skip
the code generation.  I don't think that's an unreasonable expectation from the
name of the option and the simple description of it.

Also I wouldn't characterize the program as not having any syntax errors.  The
first example

name test2(){
name x, y;
return (x < y) ? y : x;
}

generates an compile time error as one would expect.  If the same code were
placed inside a macro, it would also provoke an error.  Then you move it into
at template - and voila - no syntax error.  This is not regular or intuitive
behavior.  When you tested it you also expected to see an error - to the extent
you tried on several versions of gcc.

If your asking me what I want, I would respond that the current behavior of the
-fsyntax-only is inconsistent and confusing and has room for improvement.  It's
not much of an answer to say "don't do that".  Taken to it's logical
conclusion, you might just skip emission of compile time errors all together
and replace them with the admonition - don't write incorrect code !

Anyway, thanks again for detecting this.

Robert Ramey