Fix C++ violation.
authorthakis <thakis@chromium.org>
Thu, 9 Apr 2015 21:22:46 +0000 (14:22 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 9 Apr 2015 21:22:50 +0000 (21:22 +0000)
gcc rejects the following snippet, clang rejects it in -std=c++11 mode:
  namespace A { template<class T> class C {}; }
  namespace B { template class A::C<int>; }

Indeed, the C++ standard says in 14.7.2p2 "An explicit instantiation shall
appear in an enclosing namespace of its template", so cl.exe is incorrect to
allow this.

Just move the instantiation out of the v8 namespace to fix.  No intended
behavior change.  Fixes building with clang-cl on Windows.

BUG=chromium:475643
LOG=N
TBR=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/1073903002

Cr-Commit-Position: refs/heads/master@{#27721}

include/v8-profiler.h

index 4d8dc22..82a14d6 100644 (file)
@@ -24,11 +24,13 @@ struct CpuProfileDeoptFrame {
   size_t position;
 };
 
+}  // namespace v8
 
 #ifdef V8_OS_WIN
-template class V8_EXPORT std::vector<CpuProfileDeoptFrame>;
+template class V8_EXPORT std::vector<v8::CpuProfileDeoptFrame>;
 #endif
 
+namespace v8 {
 
 struct V8_EXPORT CpuProfileDeoptInfo {
   /** A pointer to a static string owned by v8. */
@@ -36,11 +38,13 @@ struct V8_EXPORT CpuProfileDeoptInfo {
   std::vector<CpuProfileDeoptFrame> stack;
 };
 
+}  // namespace v8
 
 #ifdef V8_OS_WIN
-template class V8_EXPORT std::vector<CpuProfileDeoptInfo>;
+template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
 #endif
 
+namespace v8 {
 
 /**
  * CpuProfileNode represents a node in a call graph.