https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70563

            Bug ID: 70563
           Summary: SFINEA fails when trying invalid template
                    instantiation
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: webmaster at havogt dot de
  Target Milestone: ---

vogt@fermi03:~/temp2> cat test_SFINAE_with_template_binding.ii 
# 1 "test_SFINAE_with_template_binding.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "test_SFINAE_with_template_binding.cc"




template<typename... T> using void_t = void;

template<typename T> struct TemporaryBindObject
{
};

struct MyTrueType
{
 static constexpr bool value = true;
};

struct MyFalseType
{
 static constexpr bool value = false;
};

template<template<typename...> class Dest> struct TestValidBind
{
 template<typename T, typename = void_t<>> struct toTypesOf : MyFalseType
 {};
 template<template<typename...> class Src, typename... Ts> struct
toTypesOf<Src<Ts...>, void_t<Dest<Ts...,float>>> : MyTrueType
 {};
};

template<typename T> struct OneParamStruct
{
};
template<typename T1, typename T2> struct TwoParamStruct
{
};

using tmp = TemporaryBindObject<int>;

int main()
{
 bool value1 =
TestValidBind<TwoParamStruct>::toTypesOf<TemporaryBindObject<int>>::value;
 bool value2 =
TestValidBind<OneParamStruct>::toTypesOf<TemporaryBindObject<int>>::value;




}
vogt@fermi03:~/temp2> g++-5 -std=c++11 test_SFINAE_with_template_binding.ii
test_SFINAE_with_template_binding.cc: In function ‘int main()’:
test_SFINAE_with_template_binding.cc:41:16: error: incomplete type
‘TestValidBind<OneParamStruct>::toTypesOf<TemporaryBindObject<int> >’ used in
nested name specifier
  bool value2 =
TestValidBind<OneParamStruct>::toTypesOf<TemporaryBindObject<int>>::value;
                ^
vogt@fermi03:~/temp2> g++-5 --version
g++-5 (SUSE Linux) 5.3.1 20160301 [gcc-5-branch revision 233849]
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


The example works with clang. I am not a standard expert to decide who is
right. Actually, a simplified version works with gcc, however I don't see the
reason why this shouldn't, see http://stackoverflow.com/a/36411945/5085250


Same problem with
vogt@fermi03:~/temp2> g++-6 --version
g++-6 (SUSE Linux) 6.0.0 20160324 (experimental) [trunk revision 234449]
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to