clang\test\CXX\temp\temp.param\p14.cpp

Richard Smith richard at metafoo.co.uk
Thu May 29 19:56:05 PDT 2014


On Tue, May 27, 2014 at 7:26 AM, Aaron Ballman <aaron at aaronballman.com>
wrote:

> This test is currently XFAILed, without any real explanation as to
> why. When I compile the test, I get:
>
> E:\llvm\2013>clang -fsyntax-only
> E:\llvm\llvm\tools\clang\test\CXX\temp\temp.par
> am\p14.cpp
> E:\llvm\llvm\tools\clang\test\CXX\temp\temp.param\p14.cpp:5:32: error: use
> of
>       undeclared identifier 'T'
> template<typename T = typename T::type> struct X; //
> expected-error{{default}}
>                                ^
> E:\llvm\llvm\tools\clang\test\CXX\temp\temp.param\p14.cpp:5:35: error:
> expected
>       a qualified name after 'typename'
> template<typename T = typename T::type> struct X; //
> expected-error{{default}}
>                                   ^
> E:\llvm\llvm\tools\clang\test\CXX\temp\temp.param\p14.cpp:5:35: error:
> type-id
>       cannot have a name
> template<typename T = typename T::type> struct X; //
> expected-error{{default}}
>                                   ^~~~
> 3 errors generated.
>
> So the test fails to compile, as expected. The error message is fairly
> reasonable. Is this XFAILed because of QoI? Or would it make sense to
> un-XFAIL this test with the appropriate changes?
>

The test is reasonable, but it shouldn't be in temp.param any more. The
relevant rule is [basic.scope.pdecl]p10. We already have relevant -- and
more thorough -- tests there (although they're in p9.cpp). I'd say just
delete this file.


> By comparison, gcc emits:
>
> prog.cpp:1:32: error: ‘T’ has not been declared
>  template<typename T = typename T::type> struct X; //
> expected-error{{default}}
>
> And MSVC requires a bit more coaxing (you have to actually instantiate
> the struct to get the diagnostic), but eventually emits: error C2079:
> 'x' uses undefined struct 'X<Test>'
>
> ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140529/ef7e2ffc/attachment.html>


More information about the cfe-commits mailing list