The attached code in 1st attachment fails with error
shown in 2nd attachment. The compiler version is
shown in 3ird attachment.
When !defined(USE_NESTED_USING), it compiles & runs OK,
even though the template arguments should be the same
(because a nested alias of the argument used in the
OK compile was used).
Is this a bug or am I missing something?
-regards,
Larry
struct out_arg {
enum class enums { enum_0, enum_1 };
};
template
< typename OutArg
>
struct outer {
using enums = typename OutArg::enums;
template <enums Enum_I, int Int>
struct inner {
static int const val;
};
};
template
< typename OutArg
>
template
#define USE_NESTED_USING
#ifndef USE_NESTED_USING
//This works:
< typename OutArg::enums Enum_I
#else
//This causes error, even though
//Outer<OutArg>::enums == OutArg::enums
< typename outer<OutArg>::enums Enum_I
#endif
, int Int
>
int const outer<OutArg>::inner<Enum_I, Int>::val = Int;
int main() {
return
outer<out_arg>::
inner<out_arg::enums::enum_1, 1>::val;
}
/home/evansl/dwnlds/llvm/3.8/prebuilt/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++
-c -O0 -stdlib=libc++ -std=c++14 -ftemplate-backtrace-limit=0
-fdiagnostics-show-template-tree -fno-elide-type -fmacro-backtrace-limit=0
-DTYPE_AT_IMPL=0 -ftemplate-depth=100 nested_template_cls_def.cpp -MMD -o
/tmp/build/clangxx3_8_pkg/clang/libcxx/sandbox/libs/gram_stk/sandbox/nested_template_cls_def.o
nested_template_cls_def.cpp:30:46: error: nested name specifier
'outer<OutArg>::inner<Enum_I, Int>::' for declaration does
not refer into a class, class template or class template partial
specialization
int const outer<OutArg>::inner<Enum_I, Int>::val = Int;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/home/evansl/dwnlds/llvm/3.8/prebuilt/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++
--version
clang version 3.8.0 (tags/RELEASE_380/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/evansl/dwnlds/llvm/3.8/prebuilt/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/bin
_______________________________________________
cfe-users mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users