Bug 105277 - compile error in kdebindings when templates expressions have ">>"
Summary: compile error in kdebindings when templates expressions have ">>"
Status: RESOLVED FIXED
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-08 10:20 UTC by Michael Pyne
Modified: 2005-07-22 02:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Pyne 2005-05-08 10:20:49 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.4.3 
OS:                Linux

kdebindings fails to compile for me in the smoke/kde directory because the automatically-generated x_7.cpp has the following:

    void x_81(Smoke::Stack x) const {
	// fallbackAccessKeysAssignments()
	QValueList<QPair<QString, QChar>> xret = this->KHTMLSettings::fallbackAccessKeysAssignments();
	x[0].s_voidp = (void*)new QValueList<QPair<QString, QChar>>(xret);
    }

Which gives this compile message:

x_7.cpp: In member function `void x_KHTMLSettings::x_81(Smoke::StackItem*) const':
x_7.cpp:4883: error: `xret' undeclared (first use this function)
x_7.cpp:4883: error: (Each undeclared identifier is reported only once for each function it appears in.)
x_7.cpp:4883: error: `this' cannot appear in a constant-expression
x_7.cpp:4883: error: '->' cannot appear in a constant-expression
x_7.cpp:4883: error: a function call cannot appear in a constant-expression
x_7.cpp:4883: error: an assignment cannot appear in a constant-expression
x_7.cpp:4883: error: `>>' should be `> >' within a nested template argument list
x_7.cpp:4884: error: `xret' cannot appear in a constant-expression
x_7.cpp:4884: error: `>>' should be `> >' within a nested template argument list
make: *** [x_7.lo] Error 1

I tried looking at kalyptus but couldn't make sense of it. :(

Changing x_7.cpp so that the '>>' nested templates are '> >' fixed the compile error.
Comment 1 Richard Dale 2005-05-08 13:17:24 UTC
On Sunday 08 May 2005 10:20, Michael Pyne wrote:
[bugs.kde.org quoted mail]
I would have said this was a compiler bug. But on the other hand there is even 
a special error message about '>>' needing to be '> >' within a nested 
template argument. Yuck, how arbitrary! So I'll fix the bug by adding a 
suitable space for types ending in '>>'. I haven't switched to subversion 
yet, so it might be a day or two.

-- Richard
Comment 2 Maksim Orlovich 2005-05-08 15:58:29 UTC
It's neither a bug, nor arbitrary. Under the longest-match rule, >> is a single token -- the right-shift operator

Comment 3 Michael Pyne 2005-05-09 00:44:46 UTC
Yes, it's even in the C++ std AFAIK.  It's been a warning since I've used g++, but I guess g++ 3.4 upgraded it to an error.
Comment 4 Richard Dale 2005-05-09 10:45:15 UTC
SVN commit 411417 by rdale:

* Fixes bug reported by Michael Payne where the code for a nested
  template return type was being generated incorrectly. The type
  'QValueList<QPair<QString, QChar> >' must have a space between
  the closing angle brackets.

CCBUGS: 105277



 M  +1 -0      trunk/KDE/kdebindings/kalyptus/kalyptusDataDict.pm  


--- trunk/KDE/kdebindings/kalyptus/kalyptusDataDict.pm #411416:411417
@@ -2950,6 +2950,7 @@
             }
             # normalize
 	    $argType = $before."<".join( ", ", @args).">".$after;
+		$argType =~ s/>>/> >/g;  # Nested template types must have a space
         }
 
 	# Parse 'const' in front of it, and '*' or '&' after it
Comment 5 Richard Dale 2005-05-09 10:58:23 UTC
On Monday 09 May 2005 10:45, Richard Dale wrote:
> * Fixes bug reported by Michael Payne where the code for a nested
>   template return type was being generated incorrectly.

Oops, sorry that should be Michael Pyne of course
Comment 6 Michael Pyne 2005-07-22 02:02:55 UTC
Fixed long ago.