public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14789] New: Preprocessor broken
@ 2004-03-30 23:43 s_gccbugzilla at nedprod dot com
  2004-03-30 23:47 ` [Bug c++/14789] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: s_gccbugzilla at nedprod dot com @ 2004-03-30 23:43 UTC (permalink / raw)
  To: gcc-bugs

A very interesting bug this - I have found it in both v3.2.2 and v3.4 CVS 
20040324:

Test source:
/* Test for GCC v3.4 preprocessor bug
by Niall Douglas
*/

class FXApp;
template<class type> class iterator_range;

#define DEFINE_MAKECARRAYITER(contType, memberType, getArrayFunction, 
getArrayFunctionPars, getArrayLengthFunction) \
	static iterator_range<memberType *> 
##contType##_##getArrayFunction##(contType &c)

DEFINE_MAKECARRAYITER(FXApp, const char *, getArgv, (), c.getArgc())

int main(void)
{
}

Trying to compile this valid code causes an error. Listing CVS output:

[ned@katey Python]$ g++ -c -E preprocbug.cpp
# 1 "preprocbug.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "preprocbug.cpp"




class FXApp;
template<class type> class iterator_range;




preprocbug.cpp:11:1: pasting ">" and "FXApp" does not give a valid preprocessing 
token
preprocbug.cpp:11:1: pasting "FXApp_getArgv" and "(" does not give a valid 
preprocessing token
static iterator_range<const char * *>FXApp_getArgv(FXApp &c)

int main(void)
{
}
[ned@katey Python]$ gcc --version
gcc (GCC) 3.4.0 20040324 (prerelease)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As you can see, it's forgetting to put a space in before the token insert. I'd 
imagine this is a very easy bug to fix for someone familiar with the code

Cheers,
Niall

-- 
           Summary: Preprocessor broken
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s_gccbugzilla at nedprod dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-03-31  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-30 23:43 [Bug c++/14789] New: Preprocessor broken s_gccbugzilla at nedprod dot com
2004-03-30 23:47 ` [Bug c++/14789] " pinskia at gcc dot gnu dot org
2004-03-31  0:00 ` [Bug preprocessor/14789] " zack at codesourcery dot com
2004-03-31  0:10 ` s_gccbugzilla at nedprod dot com
2004-03-31  9:49 ` zack at codesourcery dot com

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).