Bug 66941 - Missing diagnostic "extraneous template parameter list in template specialization"
Summary: Missing diagnostic "extraneous template parameter list in template specializa...
Status: RESOLVED DUPLICATE of bug 63809
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2015-07-20 05:58 UTC by Mikhail Maltsev
Modified: 2015-08-12 16:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 6.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Maltsev 2015-07-20 05:58:15 UTC
Consider this testcase:

$cat genpreds1_min.cc
template <typename>
class A;

template <int>
struct B;

template <typename>
struct C;

template <>
template <int N>
struct C <B <N> >
{
    template<typename T>
    A <B <N> >
    m_fn(T);
};

template <int N>
template <typename T>
A <B <N> >
C <B <N> >::m_fn (T)
{
}

EDG rejects it with the following error:
/opt/intel/bin/icpc -c genpreds1_min.cc 
genpreds1_min.cc(22): error: incomplete type is not allowed
  C <B <N> >::m_fn (T)
  ^

genpreds1_min.cc(22): error: template argument list must match the parameter list
  C <B <N> >::m_fn (T)
  ^

compilation aborted for genpreds1_min.cc (code 2)

Clang gives warning:
/opt/clang-trunk/bin/clang++ -c genpreds1_min.cc 
genpreds1_min.cc:10:1: warning: extraneous template parameter list in template specialization
template <>
^~~~~~~~~~~
1 warning generated.

But GCC silently accepts this code. I suppose that GCC could warn about:
template <typename>
struct base {};

template <typename>
struct s {};

template <>
template <typename T>
struct base <s <T> > {};

like Clang does (note: in this case EDG accepts the code without warnings/errors).
Comment 1 Mikhail Maltsev 2015-08-12 16:31:49 UTC
dup

*** This bug has been marked as a duplicate of bug 63809 ***