[CLang] Suggestion : reference to the standard on error

Hi,

Here is a suggestion that unfortunately I will not be able to try to implement, but maybe someone around here would like to consider it.
It’s not a critical nor really needed feature but I think it might be very interesting.

The idea would be to add references to paragraphs of the language standard.

I got his idea while reading the answers of this question : http://stackoverflow.com/questions/7801228/can-i-specialize-a-class-template-with-an-alias-template
In that answer there is a very clear error log from CLang (yeah clang!) then the writer had to add references to the standard to explicitly state what is allowed or not.

  1. Allowing the compiler to provide some additional references to the standard would greatly help C++ programmers who cares about this kind of details/knowledge.
    You can see a lot of answers on stackoverflow.com that have to refer to the standards to explain some ambiguous cases, like when undefined behavior will occur.
    I think that when (not if, it seems) the C++11 standard will be available to anyone for cheap, it will help spreading knowledge about correct and portable C++.

I suggest to make it a plugin or flag or something very optional.

  1. Maybe even citing the standard document would even be more useful, but would make some errors very verbose.
    I think that if it’s an interesting option too, but might require that the standard document is provided in textual (unicode) format.
    It would also be a very optional feature.

I’m not sure this feature will be really useful, but maybe it will? What do you think?

Thanks for your time.

Joël Lamotte

[snip]

The idea would be to add references to paragraphs of the language standard.

I got his idea while reading the answers of this question
: c++ - Can I specialize a class template with an alias template? - Stack Overflow
In that answer there is a very clear error log from CLang (yeah clang!)
then the writer had to add references to the standard to explicitly
state what is allowed or not.

1. Allowing the compiler to provide some additional references to the
standard would greatly help C++ programmers who cares about this kind of
details/knowledge.
You can see a lot of answers on stackoverflow.com
<http://stackoverflow.com> that have to refer to the standards to
explain some ambiguous cases, like when undefined behavior will occur.
I think that when (not if, it seems) the C++11 standard will be
available to anyone for cheap, it will help spreading knowledge about
correct and portable C++.

I suggest to make it a plugin or flag or something very optional.

2. Maybe even citing the standard document would even be more useful,
but would make some errors very verbose.
I think that if it's an interesting option too, but might require that
the standard document is provided in textual (unicode) format.
It would also be a very optional feature.

I'm not sure this feature will be really useful, but maybe it will? What
do you think?

I've seen this on an ADA compiler around 15yrs ago. I found it very
useful that the error message pointed to a specific paragraph or section
or whatever in the ADA standard.

Sorry, I don't recall the vendor,

-regards,
Larry

Klaim - Joël Lamotte wrote:

Here is a suggestion that unfortunately I will not be able to try to
implement, but maybe someone around here would like to consider it.
It's not a critical nor really needed feature but I think it might be
very interesting.

The idea would be to add references to paragraphs of the language
standard.

The TenDRA C compiler did this:

$ cat a.c
void f(int l)
{
    int a[l];
}
$ tcc -c a.c
"a.c", line 3: Error:
  [ISO C90 6.4]: Illegal integer constant expression.
  [ISO C90 6.5.4.2]: Array bound should be an integer constant expression.