https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85959

            Bug ID: 85959
           Summary: g++ doesn't show second error
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

g++ doesn't show both errors in the below example.

Also the carat is not accurate, showing carat 30, should be 20

Output:
$ g++ -o main main.cpp
main.cpp: In function ‘int main()’:
main.cpp:15:30: error: binding ‘const int’ to reference of type ‘int&’ discards
qualifiers
     strstripspace(unused, two);
                              ^
main.cpp:5:6: note:   initializing argument 1 of ‘void strstripspace(int&,
int&)’
 void strstripspace(int & value, int & two)


Expected:
$ g++ -o main main.cpp
main.cpp: In function ‘int main()’:
main.cpp:15:20: error: binding ‘const int’ to reference of type ‘int&’ discards
qualifiers
     strstripspace(unused, two);
                   ^
main.cpp:5:6: note:   initializing argument 1 of ‘void strstripspace(int&,
int&)’
 void strstripspace(int & value, int & two)

main.cpp:15:28: error: binding ‘const int’ to reference of type ‘int&’ discards
qualifiers
     strstripspace(unused, two);
                            ^
main.cpp:5:6: note:   initializing argument 2 of ‘void strstripspace(int&,
int&)’
 void strstripspace(int & value, int & two)



/* g++ -o main main.cpp -Wall -Werror -Wconversion */

#include <string>

void strstripspace(int & value, int & two)
{
    return;
}

int main()
{
    const int unused = 0;
    const int two = 0;

    strstripspace(unused, two);

    return 0;
}

Reply via email to