Testcase:

namespace x {
  struct a { };
}

template <typename t>
class foo {
};

foo<x::a> a1;
foo<x:a> a2;

x::a a3 = a2;

gcc-4.6:

clang-10.C:10:8: error: template argument 1 is invalid
clang-10.C:10:12: error: invalid type in declaration before ‘;’ token
clang-10.C:12:11: error: conversion from ‘int’ to non-scalar type ‘x::a’
requested

clang:

t2.cc:10:6: error: unexpected ':' in nested name specifier
foo<x:a> a2;
     ^
     ::
t2.cc:12:6: error: no viable conversion from 'foo<x::a>' to 'x::a'
x::a a3 = a2;
     ^    ~~
t2.cc:2:10: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'foo<x::a>' to 'x::a const' for 1st argument
  struct a { };
         ^


-- 
           Summary: improve diagnostic for :: vs : typo (complex case)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manu at gcc dot gnu dot org


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

Reply via email to