public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14387] New: syntax problem with casting operator and extra parenthesises
@ 2004-03-02 18:20 serge dot bogdanov at intel dot com
  2004-03-02 18:24 ` [Bug c++/14387] " bangerth at dealii dot org
  0 siblings, 1 reply; 2+ messages in thread
From: serge dot bogdanov at intel dot com @ 2004-03-02 18:20 UTC (permalink / raw)
  To: gcc-bugs

The following code caused g++ syntax error. All strings in the 'main' are
functionally the same. The second one differs from the first only by parens
added around the rh expression. The last one differs in the way a casting
operator is expressed. 1 and 3 lines are OK. The second gives the following:

>> gcc/3.3.2/bin/g++ -c -I$sclasssrc -I$common/include e.cxx
e.cxx: In function `int main()':
e.cxx:16: error: parse error before `<<' token

Here is the code:

template <int MSB, int LSB>
struct	Data {
    Data();
    operator unsigned ();
};

template<int EXTMSB, int EXTLSB>
struct Funct : public Data<EXTMSB - EXTLSB, 0> {
    template<int MSB, int LSB>
    Funct(const Data<MSB,LSB> &src); 
};

Data<88,0>	abc;
int main() {
    unsigned x;
    //x = unsigned(Funct<20,20>(abc)) << 1;	   // works
    x = (unsigned(Funct<20,20>(abc)) << 1);	   // does not work
    // x = ((unsigned)Funct<20,20>(abc) << 1) ;	   // works
    return 0;
}

It produces the same error in 3.2.2

-- 
           Summary: syntax problem with casting operator and extra
                    parenthesises
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: serge dot bogdanov at intel dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/14387] syntax problem with casting operator and extra parenthesises
  2004-03-02 18:20 [Bug c++/14387] New: syntax problem with casting operator and extra parenthesises serge dot bogdanov at intel dot com
@ 2004-03-02 18:24 ` bangerth at dealii dot org
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth at dealii dot org @ 2004-03-02 18:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-03-02 18:24 -------
Another instance of our most-frequently reported bug. See the bug 
reporting and non-bugs section on our web page. 
 
This is fixed in 3.4 and mainline. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to fail|                            |3.3.3
      Known to work|                            |3.4.0 3.5.0
         Resolution|                            |FIXED
            Summary|syntax problem with casting |syntax problem with casting
                   |operator and extra          |operator and extra
                   |parenthesises               |parenthesises
   Target Milestone|---                         |3.4.0


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


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

end of thread, other threads:[~2004-03-02 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 18:20 [Bug c++/14387] New: syntax problem with casting operator and extra parenthesises serge dot bogdanov at intel dot com
2004-03-02 18:24 ` [Bug c++/14387] " 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).