[cfe-dev] Diagnose local class with template?

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue Aug 20 15:24:29 PDT 2013


Thanks! PR16947.

From: Eli Friedman [mailto:eli.friedman at gmail.com]
Sent: Tuesday, August 20, 2013 3:07 PM
To: Robinson, Paul
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] Diagnose local class with template?

On Tue, Aug 20, 2013 at 2:49 PM, Robinson, Paul <Paul_Robinson at playstation.sony.com<mailto:Paul_Robinson at playstation.sony.com>> wrote:
Clang does not diagnose a local class with a template member.
gcc does.

$ cat test.cpp
int test() {
  class A {
    template<typename T> class B {
      T t;
    };
  };
  return 0;
}
$ clang -c test.cpp
$ gcc -c test.cpp
test.cpp: In function 'int test()':
test.cpp:3:5: error: invalid declaration of member template in local class
$

[temp.mem]p2 seems clear: "A local class shall not have member templates."

Is this a Clang bug or am I misreading the standard again?

Bug.

-Eli

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130820/db26ee4f/attachment.html>


More information about the cfe-dev mailing list