472,796 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

Weird error message with VC7.1

Hi,

I have some expression template code that I want to
get to work. I had a typo in it and just spent two
hours to find it, because VC7.1 gave a really weird
error message for it.
This is the code:

template< typename T1, typename TExpr, typename T2>
inline
Detail::CExpression< T2, Detail::CExpression<T1,TExpr> >
operator+( const Detail::CExpression<T1,TExpr>& expr
, const CNamedTypedParameter<T2>& par )
{
return Detail::CExpression< T2, Detail::CExpression<T1,TExpr> >( par, expr );
//return Detail::CExpression< T2, Detail::CExpression<T1,TExpr>( par, expr);
}

The code compiles fine as it is. Uncommenting commented
line (which misses a closing bracket) causes
error C2665: 'Detail::CExpression<T,TExpr>::__ctor' :
none of the 2 overloads can convert parameter 2 from type 'const Detail::CExpression<T,TExpr>'

OK, by the standard, this should be fine. I fed the
compiler none-conforming code and it spit out a
diagnostic. However, it's a very misleading one!

Did anybody else see something like this? Is it worth
spending the time to distill a repro from the code?

Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers org

"My hair style calls into immediate question all my judgements."
Scott Meyers
(http://www.google.de/groups?selm=MPG...ws.hevanet.com)
Nov 16 '05 #1
2 1603
>From: "Hendrik Schober" <Sp******@gmx.de>
Subject: Weird error message with VC7.1
Date: Mon, 11 Aug 2003 17:06:14 +0200
Lines: 41

Hi,
<snip>

OK, by the standard, this should be fine. I fed the
compiler none-conforming code and it spit out a
diagnostic. However, it's a very misleading one!

Did anybody else see something like this? Is it worth
spending the time to distill a repro from the code?

Schobi

--


Getting decent compiler diagnostics for template error messages is a
problem for all C++ compilers
not just for the Visual C++ compiler -- the problem with templates and
especially with deeply nested
templates is that the compiler can very quickly lose the context of the
user code: one rather simple
line of user code can cause the compiler to go off an instantiate 10's if
not 100's of other class
templates. We are trying to do a better job with each release: hopefully at
some point all compilers
will have clean, concise, actionable error messages for all template
diagnostics.

--
Jonathan Caves, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.

Nov 16 '05 #2
"Jonathan Caves [MSFT]" <jo******@online.microsoft.com> wrote:

Hi Jonathan,
[...]
Getting decent compiler diagnostics for template error messages is a
problem for all C++ compilers
not just for the Visual C++ compiler
Oh, I had to learn that already! :o>
-- the problem with templates and
especially with deeply nested
templates is that the compiler can very quickly lose the context of the
user code: one rather simple
line of user code can cause the compiler to go off an instantiate 10's if
not 100's of other class
templates.
I don't think that's the case here. In fact, I
think the message came up with rather simple
code. (I was, after all, still able to understand
what really was going on, once I found the typo.
And I'm usually quite bad with understanding that
template meta stuff...)
We are trying to do a better job with each release: hopefully at
some point all compilers
will have clean, concise, actionable error messages for all template
diagnostics.
Well, I'd settle for the compilers I have to use. :^>
Jonathan Caves, Visual C++ Team


Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers org

"My hair style calls into immediate question all my judgements."
Scott Meyers
(http://www.google.de/groups?selm=MPG...ws.hevanet.com)
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed...
5
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
0
by: Deutsche Dogge | last post by:
Hi. I'M having a weird problem with addign menuitems to a menu dynamically on the popup event of the menuitem containing the container of the menuitems i wanna add (tools -> external -> {list of...
2
by: Kathy Houtami | last post by:
Hi there I've been encountered with weird compile error using Access 97. The error message is "Member or data member is not found" and it highlighted a line of code that has not be changed and...
6
by: gh0st54 | last post by:
Hi I have a weird javascript error that only happens on my live server when i open the page http://www.imrated.co.uk/reg.aspx i get the error 'Problems with this page ... blablabla Line : 3...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.